OpenStack Victoria version - 4 Control node - Grace image service component

Posted by markusn00b on Fri, 18 Feb 2022 07:19:33 +0100

4. Control node - Grace image service component

More steps: OpenStack Victoria installation and deployment series tutorials

OpenStack deployment series
Openstack deployment tutorial series
OpenStack Ussuri offline installation and deployment series tutorial (full)
OpenStack Train offline installation and deployment series tutorial (full)
Welcome to leave messages for communication and common progress.

Create grace related databases, credentials and API endpoints

1. Create grace database and authorize

Use the root account of mysql database to log in, and the password is the password for initializing mysql data when preparing the control node environment. The password set is root.

mysql -u root -proot

Create the grace database and authorize it. Set the password to 111111.

CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '111111';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '111111';

flush privileges;
show databases;
select user,host from mysql.user;
exit

2. Create service credentials

(1) Create the grace user on keystone

The following commands are in local_ Create grace user from user table

source admin-openrc.sh 
openstack user create --domain default --password=111111 glance
openstack user list

(2) Add the grace user as the admin role (permission) of the service project on keystone
The following commands have no output

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

(3) The entity that creates the grace mirror service
The following command adds a grace item to the service table

openstack service create --name glance --description "OpenStack Image" image
openstack service list

3. Create API endpoint of image service

[this will affect the call of API]
The following command will add 3 items to the endpoint table

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

At this point, grace is registered on keystone and can be installed below

glance related software installation and configuration

1. Check Python version

[root@controller ~]# python --version
-bash: python: command not found
[root@controller ~]# python3
python3               python3.6             python3.6m            python3-django-admin  
[root@controller ~]# python3
Python 3.6.8 (default, Aug 24 2020, 17:57:11) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@controller ~]# 

Configure the default Python version of the system. (in practice, there is no default version configuration)

#ls /usr/bin/python*
#ln -s /usr/bin/python3.6 /usr/bin/python
#ll /usr/bin/python
#python -V

2. Install grace software

dnf install openstack-glance -y

3. Modification of configuration file

(1)glance-api.conf

Edit VIM / etc / Grace / Grace API Conf file, which contains too much content, goes to 6000 lines. It is recommended to use the command configuration as above, or you can configure it manually

cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
#vim /etc/glance/glance-api.conf
crudini --set /etc/glance/glance-api.conf database connection mysql+pymysql://glance:111111@controller/glance
crudini --set /etc/glance/glance-api.conf keystone_authtoken www_authenticate_uri http://controller:5000
crudini --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://controller:5000
crudini --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers controller:11211
crudini --set /etc/glance/glance-api.conf keystone_authtoken auth_type password
crudini --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default
crudini --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default
crudini --set /etc/glance/glance-api.conf keystone_authtoken project_name service
crudini --set /etc/glance/glance-api.conf keystone_authtoken username glance
crudini --set /etc/glance/glance-api.conf keystone_authtoken password 111111
crudini --set /etc/glance/glance-api.conf paste_deploy flavor keystone
crudini --set /etc/glance/glance-api.conf glance_store stores file,http
crudini --set /etc/glance/glance-api.conf glance_store default_store file
crudini --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
grep '^[a-z]' /etc/glance/glance-api.conf 

4. Synchronize the grace database

(1) Initialize the synchronization database for the grace mirror service
Generated related tables

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

Ignore the output, and the final result is: Database is synced successfully

(2) Connection test after synchronization
Ensure that all required tables have been created, otherwise it may not be possible to proceed later

mysql -uglance -p111111 -e "use glance;show tables;"

5. Start the grace image service and set the startup self startup

systemctl start openstack-glance-api && systemctl enable openstack-glance-api

Image upload verification

Download a test image, upload it to the system first, and then upload it to the grace service

1. Download Image

cd
wget http://download.cirros-cloud.net/0.5.0/cirros-0.5.0-x86_64-disk.img
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img

2. Load environment variables and obtain administrator permissions

source admin-openrc.sh

3. Upload image

Use qcow2 disk format and bare container format to upload the image to the image service and set it to be publicly visible, so that all projects can access it

glance image-create --name "cirros-0.5.0" --file ./cirros-0.5.0-x86_64-disk.img  --disk-format qcow2 --container-format bare  --visibility public
glance image-create --name "cirros-0.4.0" --file ./cirros-0.4.0-x86_64-disk.img  --disk-format qcow2 --container-format bare  --visibility public
openstack image create "cirros-0.3.5"  --file ./cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public

4. View image information

openstack image list

You can see the image file in the / var / lib / Grace / images / directory. If you want to delete this image, you need to delete the database information and then delete the image file

ls /var/lib/glance/images/

The image information is stored in the grace database. We can see the uploaded image information in the images table in the grace database

Grace installation configuration completed

So far, the glance image service has been successfully installed and started. If you use VMware virtual machine, you can now shut down and take a snapshot.

poweroff 

Topics: OpenStack cloud serving iaas