5. Configure the Image Service

Controller Node:
1. sudo apt-get install glance python-glanceclient
 
2. sudo vi /etc/glance/glance-api.conf  AND sudo vi /etc/glance/glance-registry.conf
[database]
connection = mysql://glance:GLANCE_DBPASS@controller/glance
 
3. sudo rm /var/lib/glance/glance.sqlite
 
4. 创建数据库
mysql -u root -p
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';
 
5. sudo -s /bin/sh -c "glance-manage db_sync" glance
 
6. 创建用户
keystone user-create --name=glance --pass=GLANCE_PASS [email protected]
keystone user-role-add --user=glance --tenant=service --role=admin
 
7. sudo vi /etc/glance/glance-api.conf  AND sudo vi /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_uri = http://controller:5000
auth_host = controller
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = GLANCE_PASS
[paste_deploy]
flavor = keystone
 
8. 
keystone service-create --name=glance --type=image --description="OpenStack Image Service"
keystone endpoint-create \
  --service-id=$(keystone service-list | awk '/ image / {print $2}') \
  --publicurl=http://controller:9292 \
  --internalurl=http://controller:9292 \
  --adminurl=http://controller:9292
 
9. sudo service glance-registry restart && sudo service glance-api restart
 
Verify:
1. 
sudo mkdir /tmp/images
cd /tmp/images/ 
 
2. 
source admin-openrc.sh
glance image-create --name "cirros-0.3.2-x86_64" --disk-format qcow2 --container-format bare --is-public True --progress < cirros-0.3.2-x86_64-disk.img
 
3. glance image-list

你可能感兴趣的:(service)