[libvirt-users] The Format Of URI when Migrating

Daniel P. Berrange berrange at redhat.com
Fri Sep 23 09:04:39 UTC 2011

On Fri, Sep 23, 2011 at 04:41:40PM +0800, huachao yao wrote:
> Hi, when I try to use such API:
> virDomainPtr <http://www.libvirt.org/html/libvirt-libvirt.html#virDomainPtr>	virDomainMigrate	(virDomainPtr
> <http://www.libvirt.org/html/libvirt-libvirt.html#virDomainPtr>
> domain,
> 					 virConnectPtr
> <http://www.libvirt.org/html/libvirt-libvirt.html#virConnectPtr>
> dconn,
> 					 unsigned long flags,
> 					 const char * dname,
> 					 const char * uri,
> 					 unsigned long bandwidth)
> to achieve the domain to the remote host. I set the "const char * uri"
> as "qemu+ssh://root@".
> But the Error "libvir: QEMU error : invalid argument in only tcp URIs
> are supported for KVM/QEMU migrations" happened.
> I want to know when i want the migrate ,how can i set the URI ? offer
> a example is better.   :-)

The answer depends on the way you invoke migration. There are essentially
two ways libvirt supports

 - "Normal" - the libvirt client co-ordinates the process, talking to
   both the source and target libvirtd daemons.
 - "Peer2Peer" - the libvirt client talks to the source libvirtd daemon.
   The source libvirtd daemon co-ordinates the process directly with
   the target libvirtd.

In the Normal case, the URI you need to give is a QEMU migration
URI such as  'tcp://hostname-of-target-host'.

In the Peer2Peer case (if you set VIR_MIGRATE_PEER2PEER in the flags
parameter), the URI you need is a normal libvirt URI such as the

>From the error message you are attempting a normal migration, so need
to give the tcp style URI i show above.

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the libvirt-users mailing list