http://docs.openstack.org/icehouse/install-guide/install/yum/content/glance-install.html
glance-api. Accepts Image API calls for image discovery, retrieval, and storage
glance-registry. Stores, processes, and retrieves metadata about images. Metadata includes items such as size and type.
Install the Image Service on the controller node:
# yum install openstack-glance python-glanceclient
# openstack-config --set /etc/glance/glance-api.conf database \
connection mysql://glance:glancepw@controller
/glance
# openstack-config --set /etc/glance/glance-registry.conf database \
connection mysql://glance:glancepw@controller
/glance
# openstack-config --set /etc/glance/glance-api.conf DEFAULT \
rpc_backend qpid
# openstack-config --set /etc/glance/glance-api.conf DEFAULT \
qpid_hostname controller
$ mysql -u root -p
mysql> CREATE DATABASE glance;
mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'glancepw';
mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'glancepw';
# su -s /bin/sh -c "glance-manage db_sync" glance
$ keystone user-create --name=glance --pass=glancepw \
--email=[email protected]
$ keystone user-role-add --user=glance --tenant=service --role=admin
# 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_host controller
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \
auth_port 35357
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \
auth_protocol http
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \
admin_tenant_name service
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \
admin_user glance
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \
admin_password glancepw
# openstack-config --set /etc/glance/glance-api.conf paste_deploy \
flavor keystone
# 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_host controller
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken \
auth_port 35357
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken \
auth_protocol http
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken \
admin_tenant_name service
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken \
admin_user glance
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken \
admin_password glancepw
# openstack-config --set /etc/glance/glance-registry.conf paste_deploy \
flavor keystone
$ 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
# service openstack-glance-api start
# service openstack-glance-registry start
# chkconfig openstack-glance-api on
# chkconfig openstack-glance-registry on
$ mkdir /tmp/images
$ cd /tmp/images/
$ wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img
//这个我作弊了,哈哈,实在是下载不下来,我就startx了,然后图形界面baidu下载的,放到那个目录下了。
source admin-openrc.sh
//参见前面的
# glance image-create --name "cirros-0.3.0-x86_64" --disk-format qcow2 \
--container-format bare --is-public True --progress < cirros-0.3.0-x86_64-disk.img
//我下的是cirros-0.3.0-x86_64-disk.img
最后验证一下,出来了,哈哈。
$ glance image-list
| a02518d3-5bfc-4bc4-93e1-f2e9b73e9aa1 | cirros-0.3.0-x86_64 | qcow2 | bare | 9761280 | active |