We will start by downloading a cirros image to the automation server. cirros is a lightweight, Linux-based image, used by many OpenStack developers and testers around the world to validate the functionality of OpenStack services:
#cd /root/ ; wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
Then, we will upload the image to the OpenStack image repository using glanceclient. Notice that we need to have the keystone token and the session parameter first, in order to communicate with glance, otherwise, glance won't accept any API requests from us.
The script will be as follows:
from keystoneauth1.identity import v3from keystoneauth1 import sessionfrom glanceclient import client as gclientfrom pprint ...