[PATCH] Ensure p2p and direct migration use the new v3 protocol if available

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

 



The internal virDomainMigratePeer2Peer and virDomainMigrateDirect
helper methods were not checking whether the target supports the
v3 migration protocol.

* src/libvirt.c: Use v3 migration protocol for p2p/direct
  migration if available.
---
 src/libvirt.c |   60 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 0542c35..ff16c48 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3903,13 +3903,28 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
     /* Perform the migration.  The driver isn't supposed to return
      * until the migration is complete.
      */
-    return domain->conn->driver->domainMigratePerform(domain,
-                                                      NULL, /* cookie */
-                                                      0,    /* cookielen */
-                                                      uri,
-                                                      flags,
-                                                      dname,
-                                                      bandwidth);
+    if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+                                 VIR_DRV_FEATURE_MIGRATION_V3)) {
+        VIR_DEBUG("Using migration protocol 3");
+        return domain->conn->driver->domainMigratePerform3(domain,
+                                                           NULL, /* cookiein */
+                                                           0,    /* cookieinlen */
+                                                           NULL, /* cookieoutlen */
+                                                           NULL, /* cookieoutlen */
+                                                           uri,
+                                                           flags,
+                                                           dname,
+                                                           bandwidth);
+    } else {
+        VIR_DEBUG("Using migration protocol 2");
+        return domain->conn->driver->domainMigratePerform(domain,
+                                                          NULL, /* cookie */
+                                                          0,    /* cookielen */
+                                                          uri,
+                                                          flags,
+                                                          dname,
+                                                          bandwidth);
+    }
 }
 
 
@@ -3940,13 +3955,28 @@ virDomainMigrateDirect (virDomainPtr domain,
     /* Perform the migration.  The driver isn't supposed to return
      * until the migration is complete.
      */
-    return domain->conn->driver->domainMigratePerform(domain,
-                                                      NULL, /* cookie */
-                                                      0,    /* cookielen */
-                                                      uri,
-                                                      flags,
-                                                      dname,
-                                                      bandwidth);
+    if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+                                 VIR_DRV_FEATURE_MIGRATION_V3)) {
+        VIR_DEBUG("Using migration protocol 3");
+        return domain->conn->driver->domainMigratePerform3(domain,
+                                                           NULL, /* cookiein */
+                                                           0,    /* cookieinlen */
+                                                           NULL, /* cookieoutlen */
+                                                           NULL, /* cookieoutlen */
+                                                           uri,
+                                                           flags,
+                                                           dname,
+                                                           bandwidth);
+    } else {
+        VIR_DEBUG("Using migration protocol 2");
+        return domain->conn->driver->domainMigratePerform(domain,
+                                                          NULL, /* cookie */
+                                                          0,    /* cookielen */
+                                                          uri,
+                                                          flags,
+                                                          dname,
+                                                          bandwidth);
+    }
 }
 
 
@@ -4207,6 +4237,7 @@ virDomainMigrateToURI (virDomainPtr domain,
     if (flags & VIR_MIGRATE_PEER2PEER) {
         if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn,
                                       VIR_DRV_FEATURE_MIGRATION_P2P)) {
+            VIR_DEBUG("Using peer2peer migration");
             if (virDomainMigratePeer2Peer (domain, flags, dname, duri, bandwidth) < 0)
                 goto error;
         } else {
@@ -4217,6 +4248,7 @@ virDomainMigrateToURI (virDomainPtr domain,
     } else {
         if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn,
                                       VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
+            VIR_DEBUG("Using direct migration");
             if (virDomainMigrateDirect (domain, flags, dname, duri, bandwidth) < 0)
                 goto error;
         } else {
-- 
1.7.4.4

--
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]