From: Daniel P. Berrange Date: Tue, 17 May 2011 12:38:30 +0000 (-0400) Subject: Ensure p2p and direct migration use the new v3 protocol if available X-Git-Tag: CVE-2011-2178~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f3c682668a9f2e3d84ec55a915b500c17c5bcf7;p=thirdparty%2Flibvirt.git Ensure p2p and direct migration use the new v3 protocol if available 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. --- diff --git a/src/libvirt.c b/src/libvirt.c index 0542c3530b..ff16c48cee 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 {