CentOS 7部署OpenStack(3)—部署Glance
1、创建数据库# mysql -u root -p -e "CREATE DATABASEglance;"Enter password: # mysql -u root -p -e "GRANT ALL PRIVILEGES ONglance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';"Enter password: # mysql -u root -p -e "GRANT ALL PRIVILEGES ONglance.* TO 'glance'@'%' IDENTIFIED BY 'glance';"Enter password:2、安装glance# yum install -y openstack-glance python-glancepython-glanceclient3、配置glance3.1、同步数据库# vim /etc/glance/glance-api.conf538 connection=mysql://glance:glance@192.168.1.11/glance# vim /etc/glance/glance-registry.conf363 connection=mysql://glance:glance@192.168.1.11/glance# su -s /bin/sh -c "glance-manage db_sync"glance3.2、创建glance用户# source admin-openrc.sh# openstack user create --domain default--password=glance glance+-----------+----------------------------------+| Field | Value |+-----------+----------------------------------+| domain_id | default || enabled | True || id |c13d8e0ef83f466e95bdd4040284c52b || name | glance |+-----------+----------------------------------+# openstack role add --project service --user glanceadmin3.3、配置glance-api3.3.1、配置连接keystone# vim /etc/glance/glance-api.conf973 974 auth_uri = http://192.168.1.11:5000975 auth_url = http://192.168.1.11:35357976 auth_plugin = password977 project_domain_id = default978 user_domain_id = default979 project_name = service980 username = glance981 password = glance1484 flavor=keystone3.3.2、配置不使用消息队列# vim /etc/glance/glance-api.conf491 notification_driver = noop3.3.3、配置镜像存放位置# vim /etc/glance/glance-api.conf642 default_store=file701 filesystem_store_datadir=/var/lib/glance/images/3.4、配置glance-registry3.4.1、配置连接keystone# vim /etc/glance/glance-registry.conf762 763 uth_uri = http://192.168.1.11:5000764 auth_url = http://192.168.1.11:35357765 auth_plugin = password766 project_domain_id = default767 user_domain_id = default768 project_name = service769 username = glance770 password = glance1256 flavor=keystone3.5、注册到keystone# openstack service create --name glance --description"OpenStack Image service" image+-------------+----------------------------------+| Field | Value |+-------------+----------------------------------+| description | OpenStack Image service || enabled | True || id |9d7176f5cfab47aa99789159dd8ea8a2 || name | glance || type | image |+-------------+----------------------------------+# openstack endpoint create --region RegionOne image public http://192.168.1.11:9292+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id |e8c6bfd66506449094a2aab994e7a4be || interface | public || region | RegionOne || region_id | RegionOne || service_id |9d7176f5cfab47aa99789159dd8ea8a2 || service_name | glance || service_type | image || url | http://192.168.1.11:9292 |+--------------+----------------------------------+# openstack endpoint create --region RegionOne image internal http://192.168.1.11:9292+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id |3b18ac8bd0764d009451223f26dccede || interface | internal || region | RegionOne || region_id | RegionOne || service_id |9d7176f5cfab47aa99789159dd8ea8a2 || service_name | glance || service_type | image || url |http://192.168.1.11:9292 |+--------------+----------------------------------+# openstack endpoint create --region RegionOne image admin http://192.168.1.11:9292+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | db9f2e251e26413d836bacd725677426|| interface | admin || region | RegionOne || region_id | RegionOne || service_id |9d7176f5cfab47aa99789159dd8ea8a2 || service_name | glance || service_type | image || url |http://192.168.1.11:9292 |+--------------+----------------------------------+4、启动glance# systemctl enable openstack-glance-api# systemctl enable openstack-glance-registry# systemctl start openstack-glance-api# systemctl start openstack-glance-registry5、添加glance环境变量# echo "export OS_IMAGE_API_VERSION=2" \| tee -a admin-openrc.sh kevin-openrc.sh6、验证是否安装成功# glance image-list+----+------+| ID | Name |+----+------++----+------+7、上传镜像下载cirros镜像,该镜像为大约13M大小的镜像# wget https://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img# rm -f cirros-0.3.4-x86_64-disk.img # # glance image-create --name "cirros" \--file cirros-0.3.4-x86_64-disk.img \--disk-format qcow2 --container-format bare \--visibility public --progress //要在镜像当前目录执行[=============================>] 100%+------------------+--------------------------------------+| Property | Value |+------------------+--------------------------------------+| checksum |ee1eca47dc88f4879d8a229cc70a07c6 || container_format | bare || created_at |2015-12-28T07:20:25Z || disk_format | qcow2 || id |de72b13d-3f0f-4292-9afa-30c94175c3b5 || min_disk | 0 || min_ram | 0 || name | cirros || owner |69d1967e59d247e6b7c4c3937d5baa89 || protected | False || size | 13287936 || status | active || tags | [] || updated_at |2015-12-28T07:20:26Z || virtual_size | None || visibility | public |+------------------+--------------------------------------+root@controller ~]# glance image-list+--------------------------------------+--------+| ID | Name |+--------------------------------------+--------+| de72b13d-3f0f-4292-9afa-30c94175c3b5 | cirros |+--------------------------------------+--------+
页:
[1]