1. 程式人生 > >OpenStack Pike Minimal安裝:三、鏡像管理

OpenStack Pike Minimal安裝:三、鏡像管理

sta yum token png int internal ble mage nec

1.創建服務憑據
#先使用腳本登陸admin
[root@controller ~]# . admin-openstack.sh

①創建glance user

openstack user create --domain default --password-prompt glance
技術分享圖片

②關聯

openstack role add --project service --user glance admin

③創建glance service

openstack service create --name glance --description "OpenStack Image" image

技術分享圖片

④創建服務API

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
技術分享圖片

2.在controller節點上安裝glance

[root@controller ~]#  yum install openstack-glance -y

3.配置glance-api.conf

[root@controller ~]# vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:glance@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 = glance

[paste_deploy]
flavor = keystone

[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

4.配置glance-registry.conf

[root@controller ~]# vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:glance@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 = glance

[paste_deploy]
flavor = keystone

5.填充數據庫

[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance
[root@controller ~]# mysql -h controller -uglance -pglance -e "use glance;show tables;"

6.啟動服務

[root@controller ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service
[root@controller ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service

7.上傳鏡像驗證

①下載測試鏡像

[root@controller ~]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img

②上傳鏡像到glance

openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
技術分享圖片

③查看鏡像列表

技術分享圖片

OpenStack Pike Minimal安裝:三、鏡像管理