1.创建Glance数据库、用户、认证
mysql -u root -p #登陆数据库
create database glance;
grant all privileges on glance.* to 'glance'@'localhost' identified by 'glance';
grant all privileges on glance.* to 'glance'@'%' identified by 'glance';
2.keystone上服务注册 ,创建glance服务实体,API端点(公有、私有、admin)
source ./admin-openstack.sh
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
3.Glance 安装软件
yum install -y openstack-glance python-glance
4.配置Glance
images默认目录:/var/lib/glance/images/
cp /etc/glance/glance-api.conf{,.bak}
egrep -v "#|^$" cp /etc/glance/glance-api.conf.bak > /etc/glance/glance-api.conf
vi /etc/glance/glance-api.conf
[DEFAULT]
[cors]
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[glance_store]
stores = file,http
default_store = file
[image_format]
[keystone_authtoken]
auth_uri = http://controller:5000/v3
auth_url = http://controller:35357/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
cp /etc/glance/glance-registry.conf.conf{,.bak}
egrep -v "#|^$" cp /etc/glance/glance-registry.conf.bak > /etc/glance/glance-registry.conf
vi /etc/glance/glance-registry.conf
[DEFAULT]
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000/v3
auth_url = http://controller:35357/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
5.同步数据库,检查数据库
su -s /bin/sh -c "glance-manage db_sync" glance
6.启动服务并设置开机自启动
systemctl enable openstack-glance-api openstack-glance-registry
systemctl start openstack-glance-api openstack-glance-registry
netstat -antp|egrep '9292|9191'
7.参考 openstack 制作centos7镜像和win7镜像 制作centos7镜像,并镜像测试
openstack image create "centos7" --file /home/centos7.qcow2 --disk-format qcow2 --container-format bare --public
#镜像默认路径:/var/lib/glance/images/
openstack image list