一、 base节点配置
#设置数据库,创建glance数据库,并设置权限
mysql -u root -proot
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
二、 ctrl节点配置
#运行变量
. admin-openrc
#创建用户glance、角色为admin
openstack user create --domain default --password GLANCE_PASS glance
openstack role add --project service --user glance admin
#创建glance服务并设置endpoint
openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://ctrl.test.com:9292
openstack endpoint create --region RegionOne image internal http://ctrl.test.com:9292
openstack endpoint create --region RegionOne image admin http://ctrl.test.com:9292
#安装镜像软件并编辑glance-api配置文件
yum install openstack-glance -y
vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@base.test.com/glance
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
#编辑glance-registry的注册配置文件
vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@base.test.com/glance
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
flavor = keystone
#初始化镜像数据库(21个数据表)
su -s /bin/sh -c "glance-manage db_sync" glance
#启动服务
systemctl restart openstack-glance-api.service
systemctl restart openstack-glance-registry.service
systemctl enable openstack-glance-api.service
systemctl enable openstack-glance-registry.service
#运行变量
. admin-openrc
#下载镜像
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
scp root@172.16.3.1:/var/lib/libvirt/image/chen.qcow2 /root/
openstack image create "cirros"
--file cirros-0.3.5-x86_64-disk.img
--disk-format qcow2 --container-format bare
--public
openstack image create "chen"
--file chen.qcow2
--disk-format qcow2 --container-format bare
--public
#查看image镜像:openstack image list