Launching the instance

The final part is to glue everything together. We have the boot image, the instance flavor, and the network that connects the machine with the other instances. We're ready to launch the instance using the nova client (remember that nova is responsible for the virtual machine life cycle and the CRUD operations on the VM):

print("=================Launch The Instance=================")image_name = glance.images.get(image.id)network1 = neutron.list_networks(name="python_network")instance_nics = [{'net-id': network1["networks"][0]["id"]}]server = nova.servers.create(name = "python-instance",                             image = image_name.id,                             flavor = instance_flavor.id,                             nics = instance_nics,)status = server.statuswhile status == 'BUILD':    print("Sleeping ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.