]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
migration: move implementation check to branches in p2p
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Fri, 2 Oct 2015 07:52:43 +0000 (10:52 +0300)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 12 Oct 2015 11:30:55 +0000 (13:30 +0200)
This is more structured code so it will be easier to add branch for _PARAMS
protocol here. It is not a pure refactoring strictly speaking as we remove
scenarios for broken cases when driver defines V3 feature and implements
perform function. So it is additionally a more solid code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
src/libvirt-domain.c

index 35d60d004f8296f5757bd515ffb202f687228ff4..83245fe9e770ebfc1352eb1de456623d8fb5f66a 100644 (file)
@@ -3339,23 +3339,25 @@ virDomainMigratePeer2PeerPlain(virDomainPtr domain,
                      dconnuri, NULLSTR(xmlin), NULLSTR(dname), NULLSTR(uri),
                      bandwidth, flags);
 
-    if (!domain->conn->driver->domainMigratePerform &&
-        !domain->conn->driver->domainMigratePerform3) {
-        virReportUnsupportedError();
-        return -1;
-    }
-
     if (virDomainMigrateCheckNotLocal(dconnuri) < 0)
         return -1;
 
     if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
                                  VIR_DRV_FEATURE_MIGRATION_V3)) {
         VIR_DEBUG("Using migration protocol 3");
+        if (!domain->conn->driver->domainMigratePerform3) {
+            virReportUnsupportedError();
+            return -1;
+        }
         return domain->conn->driver->domainMigratePerform3
                 (domain, xmlin, NULL, 0, NULL, NULL, dconnuri,
                  uri, flags, dname, bandwidth);
     } else {
         VIR_DEBUG("Using migration protocol 2");
+        if (!domain->conn->driver->domainMigratePerform) {
+            virReportUnsupportedError();
+            return -1;
+        }
         if (xmlin) {
             virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
                            _("Unable to change target guest XML during "