[libvirt] [PATCH 2/1] Non-support for VIR_MIGRATE_TUNNELLED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is just an example.  Unlike the previous patch, this one
of course is not ready for committing.

* include/libvirt/libvirt.h.in: Add VIR_MIGRATE_TUNNELLED.
* src/libvirt.c: Implement non-support for VIR_MIGRATE_TUNNELLED.
* src/virsh.c: Add --tunnelled arg to virsh migrate.
---
 include/libvirt/libvirt.h.in |    3 ++-
 src/libvirt.c                |   14 +++++++++++---
 tools/virsh.c                |    4 ++++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 4e63e48..fa54be1 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -336,7 +336,8 @@ typedef virDomainInterfaceStatsStruct *virDomainInterfaceStatsPtr;
 
 /* Domain migration flags. */
 typedef enum {
-  VIR_MIGRATE_LIVE              = 1, /* live migration */
+    VIR_MIGRATE_LIVE              = (1 << 0), /* live migration */
+    VIR_MIGRATE_TUNNELLED         = (1 << 1), /* tunnel migration data over libvirtd connection */
 } virDomainMigrateFlags;
 
 /* Domain migration. */
diff --git a/src/libvirt.c b/src/libvirt.c
index f0ec640..811c50d 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2918,6 +2918,8 @@ virDomainMigrateVersion1 (virDomainPtr domain,
     char *cookie = NULL;
     int cookielen = 0;
 
+    assert (!(flags & VIR_MIGRATE_TUNNELLED));
+
     /* Prepare the migration.
      *
      * The destination host may return a cookie, or leave cookie as
@@ -2982,6 +2984,8 @@ virDomainMigrateVersion2 (virDomainPtr domain,
     char *dom_xml = NULL;
     int cookielen = 0, ret;
 
+    assert (!(flags & VIR_MIGRATE_TUNNELLED));
+
     /* Prepare the migration.
      *
      * The destination host may return a cookie, or leave cookie as
@@ -3098,7 +3102,9 @@ virDomainMigrateP2P (virDomainPtr domain,
  *
  * dconn can be NULL.  Then the uri parameter will then be a
  * valid libvirt connection URI, by which the source libvirt
- * driver can connect to the destination libvirt.
+ * driver can connect to the destination libvirt.  If this
+ * scheme is used and the hypervisor supports it, the
+ * VIR_MIGRATE_TUNNELLED flag can also be set.
  *
  * If the dconn argument is set, the URI parameter takes a
  * hypervisor specific format. The hypervisor capabilities XML
@@ -3192,13 +3198,15 @@ virDomainMigrate (virDomainPtr domain,
             protocol = VIR_DRV_FEATURE_MIGRATION_P2P;
 
         /* For these, migration has to be supported by both drivers. */
-        else if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn,
+        else if (!(flags & VIR_MIGRATE_TUNNELLED) &&
+                 VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn,
                                            VIR_DRV_FEATURE_MIGRATION_V1) &&
                  VIR_DRV_SUPPORTS_FEATURE (dconn->driver, dconn,
                                            VIR_DRV_FEATURE_MIGRATION_V1))
             protocol = VIR_DRV_FEATURE_MIGRATION_V1;
 
-        else if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn,
+        else if (!(flags & VIR_MIGRATE_TUNNELLED) &&
+                 VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn,
                                            VIR_DRV_FEATURE_MIGRATION_V2) &&
                  VIR_DRV_SUPPORTS_FEATURE (dconn->driver, dconn,
                                            VIR_DRV_FEATURE_MIGRATION_V2))
diff --git a/tools/virsh.c b/tools/virsh.c
index a3d92df..55b1d76 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2462,6 +2462,7 @@ static const vshCmdInfo info_migrate[] = {
 
 static const vshCmdOptDef opts_migrate[] = {
     {"live", VSH_OT_BOOL, 0, gettext_noop("live migration")},
+    {"tunnelled", VSH_OT_BOOL, 0, gettext_noop("tunnelled migration")},
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")},
     {"desturi", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("connection URI of the destination host")},
     {"migrateuri", VSH_OT_DATA, 0, gettext_noop("migration URI, usually can be omitted")},
@@ -2499,6 +2500,9 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptBool (cmd, "live"))
         flags |= VIR_MIGRATE_LIVE;
 
+    if (vshCommandOptBool (cmd, "tunnelled"))
+        flags |= VIR_MIGRATE_TUNNELLED;
+
     if (migrateuri == NULL) {
         /* Let libvirt handle opening the connection if necessary.  */
         ddom = virDomainMigrate (dom, NULL, flags, dname, desturi, 0);
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]