April 2018
Intermediate to advanced
280 pages
8h 37m
English
Sometimes, you may want to create a persistent image of a running VM so that you can launch more VMs with similar operating systems and applications. You can create a Glance image from a VM programmatically by invoking the create_server_image() function call. It accepts the ID of the VM or Server instance object, the name to be given to the image, and the metadata to be associated to the image. The metadata can be set to None:
def create_image_from_vm(conn): server_id="7cdaa375-f1b5-40ab-81bd-7e3d052f370d" conn.compute.create_server_image(server_id,"vm_image", metadata=None)