Developing OpenStack compute applications
The OpenStack Compute service provides a hypervisor, which is used to host virtual machines. In Chapter 2, Exploring AWS Cloud, we have seen how to use the dashboard to launch and manipulate virtual machines in OpenStack. Lets now write some code to perform similar actions.
Listing nova networks
The OpenStack compute service (code-named NOVA) provides networks called nova networks, which can be consumed by the virtual machines. The connection object can refer the network
 class and invoke the networks()
 function to get a list of all the available nova networks.
The following function demonstrates this:
deflist_networks(conn):print("List Networks:") fornetworkinconn.network.networks():print(network)
Creating an SSH key-pair
When an OpenStack virtual machine is launched, you need an SSH key-pair to log in to the virtual machine.
In the following code, we first determine if there's already an existing keypair with the same name. If there isn't, we invoke the...