[libvirt-users] cannot perform tunnelled migration without using peer2peer flag

Eric Blake eblake at redhat.com
Mon Jul 18 19:11:42 UTC 2011


On 07/18/2011 04:11 AM, Osier Yang wrote:
> 于 2011年07月18日 10:07, zhang xintao 写道:
>> Dear All
>> I try to migration a kvm guest os to another host failed
>> server: ubuntu 11.04 server
>> virsh:migrate --live --tunnelled vm1 qemu+ssh://192.168.10.3/system
>> error:Requested operation is not valid:cannot perform
>> tunnelled migration without using peer2peer flag
>
> The error tells you all, you need to use "--p2p".

That said, why can't virsh be smarter, and automatically request the 
right underlying flags without making the user also type --p2p?  Any 
problems with this patch?

 From db318d41c2a70189c21303c824aa4a862815874a Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake at redhat.com>
Date: Mon, 18 Jul 2011 13:10:29 -0600
Subject: [PATCH] virsh: make migrate --tunnelled imply --p2p

We can make the virsh migrate UI friendlier by supplying the
missing bit automatically instead of erroring out when requesting
--tunnelled without --p2p.

* tools/virsh.c (doMigrate): Make --p2p optional when using
--tunnelled.
* tools/virsh.pod (migrate): Tweak wording accordingly.
---
  tools/virsh.c   |    2 +-
  tools/virsh.pod |    5 +++--
  2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 6c8032f..05aeb6c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -4475,7 +4475,7 @@ doMigrate (void *opaque)
      if (vshCommandOptBool (cmd, "p2p"))
          flags |= VIR_MIGRATE_PEER2PEER;
      if (vshCommandOptBool (cmd, "tunnelled"))
-        flags |= VIR_MIGRATE_TUNNELLED;
+        flags |= VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER;

      if (vshCommandOptBool (cmd, "persistent"))
          flags |= VIR_MIGRATE_PERSIST_DEST;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index e156232..e0adc31 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -534,14 +534,15 @@ Provide the maximum number of virtual CPUs 
supported for a guest VM on
  this connection.  If provided, the I<type> parameter must be a valid
  type attribute for the <domain> element of XML.

-=item B<migrate> [I<--live>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
+=item B<migrate> [I<--live>] [I<--direct>] [I<--p2p>] [I<--tunnelled>]
  [I<--persistent>] [I<--undefinesource>] [I<--suspend>] 
[I<--copy-storage-all>]
  [I<--copy-storage-inc>] [I<--verbose>] I<domain-id> I<desturi> 
[I<migrateuri>]
  [I<dname>] [I<--timeout> B<seconds>]

  Migrate domain to another host.  Add I<--live> for live migration; 
I<--p2p>
  for peer-2-peer migration; I<--direct> for direct migration; or 
I<--tunnelled>
-for tunnelled migration.  I<--persistent> leaves the domain persistent on
+for tunnelled migration (I<--tunnelled> implies I<--p2p>).  I<--persistent>
+leaves the domain persistent on
  destination host, I<--undefinesource> undefines the domain on the 
source host,
  and I<--suspend> leaves the domain paused on the destination host.
  I<--copy-storage-all> indicates migration with non-shared storage with 
full
-- 
1.7.4.4



-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvirt-users mailing list