Creating instances from Python
To get instance up and running, OpenStack instances require three components. The boot image, which is provided by glance
, the network ports, which provided by neutron
, and finally, the compute flavor that defines the number of CPUs, amount of RAM that will be allocated to the instance and disk size. The flavor is provided by nova
project.
Creating the image
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...