This script let's you easily interact with openstack. You can:
- Upload or remove images
- Create or delete virtual machines running on openstack
Before running this script you will need:
- The python novaclient installed
sudo apt-get install python-novaclient python-glanceclient-
Environment variables for authentication set up
In order to authenticate the user with Openstack a number of environment variables are needed. These are normally contained in a script generated by Openstack. In order to add the variables in this script to your environment variables run:
source <name_of_script>The values needed are:
OS_AUTH_URL
OS_USERNAME
OS_PASSWORD
OS_PROJECT_NAME
OS_USER_DOMAIN_NAME
OS_PROJECT_DOMAIN_NAME
alias ostack='~/includeos-tools/openstack_control/openstack_control.py'- To use the short form to upload and launch an image in your current directory
ostack --instant- In order to upload an image named
examplelocated at~/ex.img
./openstack_control.py --upload_image example --image_path ~/ex.img- To create an image based on this newly uploaded image running on an easily acessed IP
./openstack_control.py --create new_vm --image example --flavor includeos.nano --network FloatingPool01 positional arguments:
name Name of the VM
optional arguments:
-h, --help show this help message and exit
--image IMAGE Name of Openstack image to use
--key_pair KEY_PAIR Name of key pair to use
--flavor FLAVOR Name of flavor to use
--network NETWORK Name of network to connect to
--image_path IMAGE_PATH
Path to image to upload
--status Return status of VM
--create Creates a new VM
--delete Delete the VM
--start Start the VM
--stop Stop the VM
--upload_image Create an image
--delete_image Delete an image