[root@controller0 ~]# . keystonerc [root@controller0 ~]# keystone token-get
[root@controller0 ~]# yum install openstack-glance python-glanceclient -y
[root@controller0 ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT sql_connection mysql://glance:openstack@controller0/glance [root@controller0 ~]# openstack-config --set /etc/glance/glance-registry.conf DEFAULT sql_connection mysql://glance:openstack@controller0/glance
[root@controller0 ~]# openstack-db --init --service glance --password openstack Please enter the password for the 'root' MySQL user: Verified connectivity to MySQL. Creating 'glance' database. Updating 'glance' database password in /etc/glance/glance-registry.conf /etc/glance/glance-api.conf Initializing the glance database, please wait... /usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability. _warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning) Complete!
[root@controller0 ~]# keystone user-create --name=glance --pass=glance --email= +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | email | | | enabled | True | | id | e9f8d113c0c341a2b7d81099f004c122 | | name | glance | | username | glance | +----------+----------------------------------+ [root@controller0 ~]# keystone user-list +----------------------------------+--------+---------+--------------------+ | id | name | enabled | email | +----------------------------------+--------+---------+--------------------+ | 6efb8d6615b84cacb7cbdf0591a66bb7 | admin | True | | | e9f8d113c0c341a2b7d81099f004c122 | glance | True | | +----------------------------------+--------+---------+--------------------+
[root@controller0 ~]# keystone user-role-add --user=glance --tenant=service --role=admin
[root@controller0 ~]# keystone service-create --name=glance --type=image --description="Glance Image Service" +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | Glance Image Service | | enabled | True | | id | 04555caea1674cc0bc17e69fa0f9ff38 | | name | glance | | type | image | +-------------+----------------------------------+ [root@controller0 ~]# keystone service-list +----------------------------------+----------+----------+---------------------------+ | id | name | type | description | +----------------------------------+----------+----------+---------------------------+ | 04555caea1674cc0bc17e69fa0f9ff38 | glance | image | Glance Image Service | | b8860e4213ef4b828e5c81b1b9e4d0bb | keystone | identity | Keystone Identity Service | +----------------------------------+----------+----------+---------------------------+
[root@controller0 ~]# keystone endpoint-create \ > --service-id=$(keystone service-list | awk '/ image / {print $2}') \ > --publicurl=http://controller0:9292 \ > --internalurl=http://controller0:9292 \ > --adminurl=http://controller0:9292 +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | adminurl | http://controller0:9292 | | id | 6be86cd7eaf94f3a90b5664a | | internalurl | http://controller0:9292 | | publicurl | http://controller0:9292 | | region | regionOne | | service_id | 04555caea1674cc0bc17e69fa0f9ff38 | +-------------+----------------------------------+ [root@controller0 ~]# keystone endpoint-list +----------------------------------+-----------+------------------------------+------------------------------+-------------------------------+----------------------------------+ | id | region | publicurl | internalurl | adminurl | service_id | +----------------------------------+-----------+------------------------------+------------------------------+-------------------------------+----------------------------------+ | 08feefcf9185e748d14d9214 | regionOne | http://controller0:5000/v2.0 | http://controller0:5000/v2.0 | http://controller0:35357/v2.0 | b8860e4213ef4b828e5c81b1b9e4d0bb | | 6be86cd7eaf94f3a90b5664a | regionOne | http://controller0:9292 | http://controller0:9292 | http://controller0:9292 | 04555caea1674cc0bc17e69fa0f9ff38 | +----------------------------------+-----------+------------------------------+------------------------------+-------------------------------+----------------------------------+
openstack-config --set /etc/glance/glance-api.conf DEFAULT debug True openstack-config --set /etc/glance/glance-api.conf DEFAULT verbose True openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller0:5000 openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller0 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 glance openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone openstack-config --set /etc/glance/glance-registry.conf DEFAULT debug True openstack-config --set /etc/glance/glance-registry.conf DEFAULT verbose True openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://controller0:5000 openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller0 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 glance openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
[root@controller0 ~]# service openstack-glance-api start Starting openstack-glance-api: [ OK ] [root@controller0 ~]# service openstack-glance-registry start Starting openstack-glance-registry: [ OK ] [root@controller0 ~]# chkconfig openstack-glance-api on [root@controller0 ~]# chkconfig openstack-glance-registry on [root@controller0 ~]# ps -ef|grep glance glance 2979 1 0 11:15 ? 00:00:00 /usr/bin/python /usr/bin/glance-api glance 2987 2979 0 11:15 ? 00:00:00 /usr/bin/python /usr/bin/glance-api glance 3009 1 1 11:16 ? 00:00:00 /usr/bin/python /usr/bin/glance-registry glance 3015 3009 0 11:16 ? 00:00:00 /usr/bin/python /usr/bin/glance-registry root 3022 2207 0 11:17 pts/0 00:00:00 grep glance [root@controller0 ~]# cat /var/log/glance/api.log [root@controller0 ~]# cat /var/log/glance/registry.log
[root@controller0 ~]# ll cirros-0.3.2-x86_64-disk.img -rw-r--r-- 1 root root Feb 25 11:31 cirros-0.3.2-x86_64-disk.img
[root@controller0 ~]# glance image-create --progress --name="CirrOS 0.3.1" --disk-format=qcow2 --container-format=ovf --is-public=true < cirros-0.3.2-x86_64-disk.img [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 64d7c1cd2b6f60c92ccb7913 | | container_format | ovf | | created_at | 2018-02-25T03:35:29 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | 2e4303e2-ac60-45ba-af59-aefb57 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | CirrOS 0.3.1 | | owner | 4e845b494bf74cbf89213bf552db8599 | | protected | False | | size | | | status | active | | updated_at | 2018-02-25T03:35:30 | | virtual_size | None | +------------------+--------------------------------------+ [root@controller0 ~]# glance image-list +--------------------------------------+--------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+--------------+-------------+------------------+----------+--------+ | 2e4303e2-ac60-45ba-af59-aefb57 | CirrOS 0.3.1 | qcow2 | ovf | | active | +--------------------------------------+--------------+-------------+------------------+----------+--------+ [root@controller0 ~]# glance image-show 2e4303e2-ac60-45ba-af59-aefb57 /usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability. _warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning) +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 64d7c1cd2b6f60c92ccb7913 | | container_format | ovf | | created_at | 2018-02-25T03:35:29 | | deleted | False | | disk_format | qcow2 | | id | 2e4303e2-ac60-45ba-af59-aefb57 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | CirrOS 0.3.1 | | owner | 4e845b494bf74cbf89213bf552db8599 | | protected | False | | size | | | status | active | | updated_at | 2018-02-25T03:35:30 | +------------------+--------------------------------------+ [root@controller0 ~]# glance member-add 2e4303e2-ac60-45ba-af59-aefb57 6efb8d6615b84cacb7cbdf0591a66bb7 [root@controller0 ~]# glance member-list --image-id 2e4303e2-ac60-45ba-af59-aefb57 +--------------------------------------+----------------------------------+-----------+ | Image ID | Member ID | Can Share | +--------------------------------------+----------------------------------+-----------+ | 2e4303e2-ac60-45ba-af59-aefb57 | 6efb8d6615b84cacb7cbdf0591a66bb7 | | +--------------------------------------+----------------------------------+-----------+
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/232817.html原文链接:https://javaforall.net