四、镜像服务glance
1、向ketstone注册服务
# openstack service create --name glance \
--description "OpenStack Image" image
# openstack endpoint create --region RegionOne \
image public http://controller:9292
# openstack endpoint create --region RegionOne \
image internal http://controller:9292
# openstack endpoint create --region RegionOne \
image admin http://controller:9292
(1)修改 /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:glance@controller/glance
#设置认证方式为keystone
[paste_deploy]
#keystone连接方式
auth_uri = http://controller:5000
memcached_servers = controller:11211
[glance_store]
filesystem_store_datadir = /var/lib/glance/images/
(2)修改/etc/glance/glance-registry.conf
#镜像上传完成后,会将镜像信息写入的数据库
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[paste_deploy]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
3、同步数据库数据
# 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
5、验证上传镜像
# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
# openstack image create "cirros" \
--file cirros-0.4.0-x86_64-disk.img \