O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Starting, stopping, and deleting KVM instances with Python

In this recipe we are going to use the create() method on the instance object we defined in the previous recipe to start it and the destroy() method to stop it.

To obtain more information on the create() method, run:

In [1]: instance.create?Type: instancemethodString Form:<bound method virDomain.create of <libvirt.virDomain object at 0x7fc5d9b97d90>>File: /root/kvm_python/lib/python2.7/site-packages/libvirt.pyDefinition: instance.create(self)Docstring:Launch a defined domain. If the call succeeds the domain moves from thedefined to the running domains pools. The domain will be paused onlyif restoring from managed state created from a paused domain. For morecontrol, see virDomainCreateWithFlags(). ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required