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:

uname -a

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.

http://nfs.sourceforge.net/nfs-howto/index.html

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

Domain mig1=testDomain1.migrate(conn1,1,string_null,dest_uri,0)

where:

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 ,

eg:String dest_uri=”tcp://username@dest_ip:port_for_conenction”;

0 specifies that infinite bandwidth is allotted.

About these ads