I. Glance environment
Reference Document: Http://www.aboutyun.com/thread-13080-1-1.html
Http://docs.openstack.org/mitaka/install-guide-ubuntu/glance-install.html
1. Create a Glance database and authorize
mysql -u root -pCREATE DATABASE glance;
- Authorization (self-setting password, connect database with, my glance)
GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘GLANCE_PASS‘;GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘ IDENTIFIED BY ‘GLANCE_PASS‘;
exit
2. Effective Admin environment variable
source admin-openrc.sh
3. Create a certification service
openstack user create --password-prompt glanceUser Password:(我的设置glance)Repeat User Password:+-----------+----------------------------------+| Field | Value |+-----------+----------------------------------+| domain_id | e0353a670a9e496da891347c589539e9 || enabled | True || id | e38230eeff474607805b596c91fa15d9 || name | glance |+-----------+----------------------------------+
- Add Admin role to glance user and service Tenant (project)
openstackroleadd--projectservice--userglanceadmin
- Create a service instance of glance
openstack service create --name glance --description "OpenStack Image" image+-------------+----------------------------------+| Field | Value |+-------------+----------------------------------+| description | OpenStack Image || enabled | True || id | 8c2c7f1b9b5049ea9e63757b5533e6d2 || name | glance || type | image |+-------------+----------------------------------+
- Create an API for the mirroring service endpoint
openstack endpoint create--publicurl Http://controller : 9292--internalurl http://controller:9292--adminurl http://controller:9292--region regionone image+--------------+ ----------------------------------+ | Field | Value |+--------------+----------------------------------+ | Adminurl | http://controller:9292 | | ID | 340be3625e9b4239a6415d034e98aace | | InternalUrl | http://controller:9292 | | Publicurl | http://controller:9292 | | Region_id | Regionone | | Service_ ID | 8c2c7f1b9b5049ea9e63757b5533e6d2 | | Service_name | glance | | service_ Type | Image | +--------------+ ----------------------------------+
Two. Installing glance
1. Installation
apt-get install glance python-glanceclient-y
2. Modify the configuration
Vim/etc/glance/glance-api.conf[default]verbose= TrueNotification_driver= Noop[database]Connection= Mysql://glance:glance_dbpass (glance database password) @controller/glance[keystone_authtoken]Auth_uri= http://controller:5000Auth_url= http://controller:35357Auth_plugin= passwordproject_domain_id= Defaultuser_domain_id= DefaultProject_Name= Serviceusername= GlancePassword= Glance_pass (GLANCE password) [Paste_deploy]Flavor= Keystone[glance_store]#配置本地文件系统存储和image文件路径Default_store= FileFilesystem_store_datadir=/var/lib/glance/images/
Save exit.
vim /etc/glance/glance-registry.conf [DEFAULT]verbose = Truenotification_driver = noop[database]connection = mysql://glance:GLANCE_DBPASS(glance数据库密码)@controller/glance[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357auth_plugin = passwordproject_domain_id = defaultuser_domain_id = defaultproject_name = serviceusername = glancepassword = GLANCE_PASS(glance密码)[paste_deploy]flavor = keystone
Save exit.
3. Synchronize the database (after synchronization, you can see if there is a table in the database, there is success, there is no indication that SQLite database is not deleted, after deletion in sync rm -f /var/lib/glance/glance.sqlite
)
-s-c"glance-manage db_sync" glance
4. Restart the Glance Service
service glance-registry restartservice glance-api restart
Three. Glance verification
1. In each client script, configure the Mirror service client to use API version 2.0
"export OS_IMAGE_API_VERSION=2"|-a admin-openrc.sh demo-openrc.sh
2.source Admin environment variable
source admin-openrc.sh
3. Create a temporary directory, download the image
mkdir /tmp/imageswget -P /tmp/images http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
4. Upload image to glance, image using Qcow2 format
Glance image-create--name "cirros-0.3.4-x86_64 "--file/tmp/cirros-0.3.4-x86_64-disk.img--disk-format qcow2--container-format bare--visibility publicprogress[============================= ] 100%+------------------+--------------------------------------+| Property | Value |+------------------+--------------------------------------+| Checksum | 133eae9fb1c98f45894a4e60d8736619 | | Container_format | bare | | created_at | 2015-03-26t16:52:10z | | Disk_format | qcow2 | | id | 38047887-61a7-41ea-9b49-27987d5e8bb9 | | min_ Disk | 0 | | Min_ram | 0 | | name | cirros-0.3.4-x86_64 | | Owner | ae7a98326b9c455588edd2656d723b9d | | protected | False | | Size | 13200896 | | Status | active | | tags | [] || Updated_at | 2015-03-26t16:52:10z | | virtual_Size | None || visibility | public | +------------------+-------------------------------------- +
5. Verify the success and remove the temp directory
glance image-list+--------------------------------------+--------+| ID | Name |+--------------------------------------+--------+| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros |+--------------------------------------+--------+rm -r /tmp/images
Note: Previously built, can run, if there are some questions written above, thank you for pointing out.
Ubuntu Build OpenStack Platform (Kilo) (three. Glance)