安装Glance,在控制节点上。
yum install openstack-glance -y
mysql -uroot -ppassword -e "CREATE DATABASE glance;"
mysql -uroot -ppassword -e "GRANT ALL PRIVILEGES ON glance. TO 'glance'@'localhost' IDENTIFIED BY 'password'"
mysql -uroot -ppassword -e "GRANT ALL PRIVILEGES ON glance. TO 'glance'@'%' IDENTIFIED BY 'password'"
source admin-openrc
openstack user create --domain default --password password 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:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292
Edit the /etc/glance/glance-api.conf file
openstack-config --set /etc/glance/glance-api.conf database connection mysql+pymysql://glance:password@controller/glance
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://controller:5000
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers controller:11211
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_type password
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_name service
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken username glance
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken password password
openstack-config --set /etc/glance/glance-api.conf glance_store stores file,http
openstack-config --set /etc/glance/glance-api.conf glance_store default_stores file
openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
Edit the /etc/glance/glance-registry.conf file
openstack-config --set /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:password@controller/glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://controller:5000
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken memcached_servers controller:11211
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_type password
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_name Default
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_name Default
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name service
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password password
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
Populate the Image service database:
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
systemctl status openstack-glance-api.service openstack-glance-registry.service
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 \
--disk-format qcow2 --container-format bare \
--public
[root@controller ~]# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 6f941925-edfa-4f43-8229-36931b727f2d | cirros | active |
+--------------------------------------+--------+--------+
[root@controller images]# ls
CentOS-7-x86_64-GenericCloud-1611.qcow2 cirros-0.4.0-x86_64-disk.img
[root@controller images]# glance image-create --name="CentOS7.3" --disk-format=qcow2 --container-format=bare --file=CentOS-7-x86_64-GenericCloud-1611.qcow2
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 056fcc63eb0e7aa3fc36c2d384e1a45d |
| container_format | bare |
| created_at | 2018-08-03T04:07:43Z |
| disk_format | qcow2 |
| id | 0195950c-4eff-4d05-b155-b5725979553d |
| min_disk | 0 |
| min_ram | 0 |
| name | CentOS7.3 |
| owner | 11cbd5919d934906817a3035aba395a7 |
| protected | False |
| size | 1317994496 |
| status | active |
| tags | [] |
| updated_at | 2018-08-03T04:08:25Z |
| virtual_size | None |
| visibility | shared |
+------------------+--------------------------------------+
[root@controller images]#
Glance安装完成
转载于:https://blog.51cto.com/andyliu/2154047