5. Control node installation

Article directory

5.1 create Glance database

mysql -uroot -pabc-123
---
create database glance;
grant all privileges on glance.* to 'glance'@'localhost' identified by 'glance';
grant all privileges on glance.* to 'glance'@'%' identified by 'glance';
flush privileges;
exit

5.2 Keystone registration

5.2.1 Keystone creates a glance user

[root@controller script]# openstack user create --domain default --password=glance glance
openstack user list+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 977f170b491d49a289677396d19caca2 |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@controller script]# openstack user list
+----------------------------------+--------+
| ID                               | Name   |
+----------------------------------+--------+
| 39732e6eef9641dca49bdee383ae02d3 | test   |
| 977f170b491d49a289677396d19caca2 | glance |
| d1379b1a6b0e4adb822be53379a228e1 | admin  |
+----------------------------------+--------+

5.2.2 add glance user to admin permission of test project on Keystone

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

5.2.3 create glance image service storage entity

[root@controller script]# openstack service create --name glance --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | 82a021613a4a4a998c3a9e789f132a2b |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
[root@controller script]# openstack service list
+----------------------------------+----------+----------+
| ID                               | Name     | Type     |
+----------------------------------+----------+----------+
| 276d5c0879f4474da63a2ac7c985d6d1 | keystone | identity |
| 82a021613a4a4a998c3a9e789f132a2b | glance   | image    |
+----------------------------------+----------+----------+

5.2.4 create image service API

openstack endpoint create --region RegionOne image public http://192.168.204.10:9292
openstack endpoint create --region RegionOne image internal http://192.168.204.10:9292
openstack endpoint create --region RegionOne image admin http://192.168.204.10:9292
openstack endpoint list

---
[root@controller script]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                        |
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| 0ea8e5a927c74ad685f533581565f66d | RegionOne | glance       | image        | True    | public    | http://192.168.202.61:9292 |
| 3ede52b43fa749d59d1897828b4fdebb | RegionOne | keystone     | identity     | True    | public    | http://controller:5000/v3/ |
| 7e26965066ca4397b9f1329a79a2641c | RegionOne | glance       | image        | True    | admin     | http://192.168.202.61:9292 |
| 9a55d8f44af8404eb6fedc26c0ccd8c8 | RegionOne | keystone     | identity     | True    | internal  | http://controller:5000/v3/ |
| dd326b060db74c7392f4a61d850a111c | RegionOne | keystone     | identity     | True    | admin     | http://controller:5000/v3/ |
| e31f5bf6559b4da8bc309445a17ed8cd | RegionOne | glance       | image        | True    | internal  | http://192.168.202.61:9292 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+

5.3 installation and configuration

5.3.1 installation of glance

yum install openstack-glance python-glance python-glanceclient -y

5.3.2 configure glance-api.conf

openstack-config --set  /etc/glance/glance-api.conf database connection  mysql+pymysql://glance:glance@controller/glance
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken www_authenticate_uri http://controller:5000
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_url http://controller:5000
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken memcached_servers  controller:11211
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_type password
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken project_name test 
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken username glance
openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken password glance
openstack-config --set  /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config --set  /etc/glance/glance-api.conf glance_store stores  file,http
openstack-config --set  /etc/glance/glance-api.conf glance_store default_store file
openstack-config --set  /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/

5.3.3 configure glance-registry.conf

openstack-config --set  /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:glance@controller/glance
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken www_authenticate_uri http://controller:5000
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_url http://controller:5000
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken memcached_servers controller:11211
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_type password
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken project_domain_name Default
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken user_domain_name Default
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken project_name test
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken username glance
openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken password glance
openstack-config --set  /etc/glance/glance-registry.conf paste_deploy flavor keystone

5.4 synchronization of glance database

5.4.1 synchronous database

su -s /bin/sh -c "glance-manage db_sync" glance

5.4.2 view the database after synchronization

mysql -h127.0.0.1 -uglance -pglance -e "use glance;show tables;"

5.5 start and configure self start

systemctl start openstack-glance-api.service openstack-glance-registry.service
systemctl status openstack-glance-api.service openstack-glance-registry.service
systemctl enable openstack-glance-api.service openstack-glance-registry.service

5.6 inspection of glance service

5.6.1 Download Image

cd /downloads/
wget http://download.cirros-cloud.net/0.3.6/cirros-0.3.6-x86_64-disk.img

5.6.2 upload image to glance

Use administrator rights
---
[root@controller downloads]# source /script/admin.sh
[root@controller downloads]# openstack image create "cirros" --file cirros-0.3.6-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                      |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | d56d54f110654dfd29b0e8ed56e6cda8                                                                                                                                                           |
| container_format | bare                                                                                                                                                                                       |
| created_at       | 2019-04-12T00:32:34Z                                                                                                                                                                       |
| disk_format      | qcow2                                                                                                                                                                                      |
| file             | /v2/images/00c1e145-4d42-4574-b812-12d8c34b0012/file                                                                                                                                       |
| id               | 00c1e145-4d42-4574-b812-12d8c34b0012                                                                                                                                                       |
| min_disk         | 0                                                                                                                                                                                          |
| min_ram          | 0                                                                                                                                                                                          |
| name             | cirros                                                                                                                                                                                     |
| owner            | d0193ffb13d24d4abd2f308ae6b30421                                                                                                                                                           |
| properties       | os_hash_algo='sha512', os_hash_value='defa5791135001cb4c1e51efbdc8a6de5bfab20d425abaaabc30f5c1a371000d83a89fb5a7064044d30cfc55721bdf9e122685cb6e08a7b89c56a9e4d98f95a9', os_hidden='False' |
| protected        | False                                                                                                                                                                                      |
| schema           | /v2/schemas/image                                                                                                                                                                          |
| size             | 13256192                                                                                                                                                                                   |
| status           | active                                                                                                                                                                                     |
| tags             |                                                                                                                                                                                            |
| updated_at       | 2019-04-12T00:32:35Z                                                                                                                                                                       |
| virtual_size     | None                                                                                                                                                                                       |
| visibility       | public                                                                                                                                                                                     |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

5.6.3 view image

[root@controller downloads]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 00c1e145-4d42-4574-b812-12d8c34b0012 | cirros | active |
+--------------------------------------+--------+--------+

Tags: OpenStack Database MySQL Python

Posted on Thu, 28 Nov 2019 13:14:16 -0800 by prasitc2005