It is *not* a pure refactoring patch as it introduces offline check for older
versions. Looks like it must be done that way and no one will be broken too.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/libvirt-domain.c | 75 ++++++++++----------------------------------------
1 files changed, 15 insertions(+), 60 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index eec45bd..fc61830 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -4253,7 +4253,6 @@ virDomainMigrateToURI(virDomainPtr domain,
/* First checkout the source */
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, error);
-
virCheckNonNullArgGoto(duri, error);
if (virDomainMigrateUnmanagedCheckCompat(domain, flags) < 0)
@@ -4382,37 +4381,15 @@ virDomainMigrateToURI2(virDomainPtr domain,
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, error);
- VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
- VIR_MIGRATE_NON_SHARED_INC,
- error);
+ if (virDomainMigrateUnmanagedCheckCompat(domain, flags) < 0)
+ goto error;
- 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 (virDomainMigrateUnmanaged(domain, dxml, flags,
- dname, dconnuri, miguri, bandwidth) < 0)
- goto error;
- } else {
- /* No peer to peer migration supported */
- virReportUnsupportedError();
- goto error;
- }
- } else {
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
- VIR_DEBUG("Using direct migration");
- if (virDomainMigrateUnmanaged(domain, dxml, flags,
- dname, NULL, miguri, bandwidth) < 0)
- goto error;
- } else {
- /* Cannot do a migration with only the perform step */
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("direct migration is not supported by the"
- " connection driver"));
- goto error;
- }
- }
+ if (!(flags & VIR_MIGRATE_PEER2PEER))
+ dconnuri = NULL;
+
+ if (virDomainMigrateUnmanaged(domain, NULL, flags,
+ dname, dconnuri, miguri, bandwidth) < 0)
+ goto error;
return 0;
@@ -4476,37 +4453,15 @@ virDomainMigrateToURI3(virDomainPtr domain,
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, error);
- VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
- VIR_MIGRATE_NON_SHARED_INC,
- error);
-
- if (flags & VIR_MIGRATE_PEER2PEER) {
- if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_P2P)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("Peer-to-peer migration is not supported by "
- "the connection driver"));
- goto error;
- }
+ if (virDomainMigrateUnmanagedCheckCompat(domain, flags) < 0)
+ goto error;
- VIR_DEBUG("Using peer2peer migration");
- if (virDomainMigrateUnmanagedParams(domain, dconnuri, params, nparams, flags)
< 0)
- goto error;
- } else {
- if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
- /* Cannot do a migration with only the perform step */
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("Direct migration is not supported by the"
- " connection driver"));
- goto error;
- }
+ if (!(flags & VIR_MIGRATE_PEER2PEER))
+ dconnuri = NULL;
- VIR_DEBUG("Using direct migration");
- if (virDomainMigrateUnmanagedParams(domain, NULL, params,
- nparams, flags) < 0)
- goto error;
- }
+ if (virDomainMigrateUnmanagedParams(domain, dconnuri,
+ params, nparams, flags) < -1)
+ goto error;
return 0;
--
1.7.1