In this recipe, we are using the pre-existing raw Debian image we created in Chapter 1, Getting Started with QEMU and KVM, to define the KVM instance.
In step 1, we import the libvirt package and proceed to define the new KVM instance. We assign the XML formatted string to the xmlconfig variable in step 2. Notice that the definition contains the name of the new instance and the location of the image file.
In step 3, we obtain a connection object and assign it to the conn variable. We can now use the available methods to define the KVM guest.