The steps to be taken for KVM migration using Libvirt API’s Java functions are:
1. Check the compatibility of both the host and guest systems. This can be done using:
Also, make sure that the identical versions of KVM/ Qemu is installed on both physical machines.
2. Create an NFS between the host and guest systems. This might help you out.
3. Open a connection to the Qemu hypervisor of the destination machine:
conn1 = new Connect(“qemu+ssh://username@destination_ip/system”, false);
The connection can also be opened by other options such as qemu+tcp-http://libvirt.org/remote.html
and false asks the hypervisor to open a read-write connection . A read write connection is necessary for
the migration to take place.
3. Use the migration function:
public Domain migrate(Connect dconn, long flags, java.lang.String dname, java.lang.String uri, long bandwidth) throws LibvirtException
testDomain1 is type Domain and initialized to null,
string_null is a null string since Qemu doesn’t allow renaming of domains while live migration,
dest_uri is of type string which gives the destination path of the destination physical machine ,
0 specifies that infinite bandwidth is allotted.