1、创建Glance数据库
root@controller:~/ocata# MysqL -uroot -p -e "CREATE DATABASE glance"
Enter password:
root@controller:~/ocata# MysqL -uroot -p -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'zoomtech'"
root@controller:~/ocata# MysqL -uroot -p -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'zoomtech'"
2、创建Glance用户、
root@controller:~/ocata# source admin-openrc
root@controller:~/ocata# openstack user create --domain default --password-prompt glance
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
| domain_id | default |
| enabled | True |
| id | 077fa99f355f43389d28bf476e1c4549 |
| name | glance |
| options | {} |
| password_expires_at | None |
root@controller:~/ocata# openstack role add --project service --user glance admin
3、创建glance服务
root@controller:~/ocata# openstack service create --name glance \
--description "OpenStack Image" image
+-------------+----------------------------------+
| Field | Value |
| description | OpenStack Image |
| enabled | True |
| id | 86a9f0234e4846bdac32c10b553a41f5 |
| name | glance |
| type | image |
4、创建glance API端点
root@controller:~/ocata# openstack endpoint create --region RegionOne \
image public http://controller:9292
+--------------+----------------------------------+
| Field | Value |
| enabled | True |
| id | 47bce25719a24321980283481d751374 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 86a9f0234e4846bdac32c10b553a41f5 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
image internal http://controller:9292
| id | 53e7ab3597ad4543bde2d85e780d3736 |
| interface | internal |
> image admin http://controller:9292
| id | 4fc7c8f3208a4159a34ee23e733e5115 |
| interface | admin |
root@controller:~/ocata#
5、配置glance api
root@controller:~/ocata# vim /etc/glance/glance-api.conf
[database]
connection = MysqL+pyMysqL://glance:zoomtech@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = zoomtech
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
6、配置glance registry
root@controller:~/ocata# vim /etc/glance/glance-registry.conf
7、同步数据库
root@controller:~/ocata# su -s /bin/sh -c "glance-manage db_sync" glance
8、启动glance
root@controller:~/ocata# service glance-registry restart
root@controller:~/ocata# service glance-api restart
root@controller:~/ocata# service glance-registry status
root@controller:~/ocata# service glance-api status
9、测试images
root@controller:~/ocata# wget wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
root@controller:~/ocata# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field | Value |
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2017-02-28T05:53:02Z |
| disk_format | qcow2 |
| file | /v2/images/9b51b435-c6ed-4c8d-814b-760cda0d813e/file |
| id | 9b51b435-c6ed-4c8d-814b-760cda0d813e |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | 56d3f276e94d48ffb014a6fe5776d0e5 |
| protected | False |
| schema | /v2/schemas/image |
| size | 13287936 |
| status | active |
| tags | |
| updated_at | 2017-02-28T05:53:02Z |
| virtual_size | None |
| visibility | public |
root@controller:~/ocata# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
| 9b51b435-c6ed-4c8d-814b-760cda0d813e | cirros | active |
+--------------------------------------+--------+--------+
原文链接:https://www.f2er.com/ubuntu/354328.html