Installing Glance Client
First, search for the apppropriate OpenStack release matching your environment, then install the corresponding repository and glance client packages.
dnf search all openstack
dnf install centos-release-openstack-yoga.noarch -y
dnf search all glance
dnf install python3-glanceclient -y
Environment Configuraton
Configure the required environment variables for authentication. These variables tell the glance client how to connect to your OpenStack Identity service and access the Image service.
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=service
export OS_USERNAME=GLANCE
export OS_PASSWORD=GLANCE_PASS
export OS_PROJECT_ID=d660e1d89bca45329cd3bf9f7ef8368b
export OS_AUTH_URL=http://OPENSTACK:5000/v3
export OS_IMAGE_URL=http://OPENSTACK:9292
export OS_AUTH_TOKEN=gAAAAABknn-JUWRwbCrIl3FY4xtEtQ9FGMEBhn5q_umwBAXIJ3Qy8Bt237oiHmo3demVB2T2-5z7Jd2gAEWdDIiZNxgbCJi-ABGMtRNZov_gqHiEWH9fG1X27XQsNV6xZFMtt5ce82hR9LSHXDEtbsUfe-edaYspmeccdoAFpAR-p_dv04FAia8
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
Note: The authentication token must be obtained from the OpenStack Identity service. Update the token value after retrieving it.
Obtaining Authentication Token
Use the following curl command to authenticate and retrieve a fresh token from the Keystone service:
curl -s -X POST $OS_AUTH_URL/auth/tokens?nocatalog \
-H "Content-Type: application/json" \
-d '{ "auth": { "identity": { "methods": ["password"], "password": { "user": { "domain": { "name": "'"$OS_USER_DOMAIN_NAME'" }, "name": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'" } } }, "scope": { "project": { "domain": { "name": "'"$OS_PROJECT_DOMAIN_NAME'" }, "name": "'"$OS_PROJECT_NAME"'" } } } }' \
-D - | awk '/X-Subject-Token/ { print $2 }'
Copy the returned token and update the OS_AUTH_TOKEN environment variable with this value.
After configuring all environment variables, load them into your current shell sestion:
source ~/.bashrc
Testing Glance Client
Verify the configuration by listing available images in the OpenStack Image service:
[root@spf-azkaban-4 data]# glance image-list
+--------------------------------------+-----------------------------------------+
| ID | Name |
+--------------------------------------+-----------------------------------------+
| a9dcc446-36f2-4a88-bcfd-75fce71ef65f | CentOS-7-x86_64-DVD-2009-iso |
| 795984c4-0984-4dba-a889-5abeb05c7036 | CentOS-7.9.2009-minimal |
| 7b85585a-20a1-460e-ad2e-ab46763b920d | CentOS-Stream-8-minimal |
+--------------------------------------+-----------------------------------------+
If the image list displays correctly, the glance client is properly installed and configured.