openstack 部署笔记--glance
控制节点
创建用户及服务
$ . admin-openrc
$ openstack user create --domain default --password-prompt glance $ openstack role add --project service --user glance admin $ openstack service create --name glance \ --description "OpenStack Image" image $ openstack endpoint create --region RegionOne \ image public http://controller.cn:9292 $ openstack endpoint create --region RegionOne \ image internal http://controller:9292 $ openstack endpoint create --region RegionOne \ image admin http://controller:9292
配置glance
# yum install openstack-glance # vim /etc/glance/glance-api.conf [database] # ... connection = mysql+pymysql://glance:root@controller/glance [keystone_authtoken] # ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = root [paste_deploy] # ... flavor = keystone [glance_store] # ... stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/
# vim /etc/glance/glance-registry.conf [database] # ... connection = mysql+pymysql://glance:root@controller/glance [keystone_authtoken] # ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = root [paste_deploy] # ... flavor = keystone
同步数据库
# su -s /bin/sh -c "glance-manage db_sync" glance
# systemctl enable openstack-glance-api.service \ openstack-glance-registry.service # systemctl start openstack-glance-api.service \ openstack-glance-registry.service
验证配置
$ . admin-openrc $ wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img $ openstack image create "cirros" \ --file cirros-0.3.5-x86_64-disk.img \ --disk-format qcow2 --container-format bare \ --public $ openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros | active | +--------------------------------------+--------+--------+