[libvirt] [PATCH] libvirt.c: Make VIR_MIGRATE_NON_SHARED_{INC, DISK} mutually exclusive

These two flags in fact are mutually exclusive. Requesting them both doesn't make any sense regardless of hypervisor driver. Hence, we have to make it within libvirt.c file instead of fixing it in each driver. --- src/libvirt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/libvirt.c b/src/libvirt.c index 934997a..63416aa 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -5161,6 +5161,10 @@ virDomainMigrateDirect(virDomainPtr domain, * XML includes details of the support URI schemes. If omitted * the dconn will be asked for a default URI. * + * If you want to copy non-shared storage within migration you + * can use either VIR_MIGRATE_NON_SHARED_DISK or + * VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive. + * * In either case it is typically only necessary to specify a * URI if the destination host has multiple interfaces and a * specific interface is required to transmit migration data. @@ -5221,6 +5225,15 @@ virDomainMigrate(virDomainPtr domain, goto error; } + if (flags & VIR_MIGRATE_NON_SHARED_DISK && + flags & VIR_MIGRATE_NON_SHARED_INC) { + virReportInvalidArg(flags, + _("flags 'shared disk' and 'shared incremental' " + "in %s are mutually exclusive"), + __FUNCTION__); + goto error; + } + if (flags & VIR_MIGRATE_OFFLINE) { if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_OFFLINE)) { @@ -5375,6 +5388,10 @@ error: * XML includes details of the support URI schemes. If omitted * the dconn will be asked for a default URI. * + * If you want to copy non-shared storage within migration you + * can use either VIR_MIGRATE_NON_SHARED_DISK or + * VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive. + * * In either case it is typically only necessary to specify a * URI if the destination host has multiple interfaces and a * specific interface is required to transmit migration data. @@ -5448,6 +5465,15 @@ virDomainMigrate2(virDomainPtr domain, goto error; } + if (flags & VIR_MIGRATE_NON_SHARED_DISK && + flags & VIR_MIGRATE_NON_SHARED_INC) { + virReportInvalidArg(flags, + _("flags 'shared disk' and 'shared incremental' " + "in %s are mutually exclusive"), + __FUNCTION__); + goto error; + } + if (flags & VIR_MIGRATE_OFFLINE) { if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_OFFLINE)) { @@ -5601,6 +5627,10 @@ error: * * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set. * + * If you want to copy non-shared storage within migration you + * can use either VIR_MIGRATE_NON_SHARED_DISK or + * VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive. + * * If a hypervisor supports renaming domains during migration, * the dname parameter specifies the new name for the domain. * Setting dname to NULL keeps the domain name the same. If domain @@ -5648,6 +5678,15 @@ virDomainMigrateToURI(virDomainPtr domain, virCheckNonNullArgGoto(duri, error); + if (flags & VIR_MIGRATE_NON_SHARED_DISK && + flags & VIR_MIGRATE_NON_SHARED_INC) { + virReportInvalidArg(flags, + _("flags 'shared disk' and 'shared incremental' " + "in %s are mutually exclusive"), + __FUNCTION__); + goto error; + } + if (flags & VIR_MIGRATE_OFFLINE && !VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_OFFLINE)) { @@ -5741,6 +5780,10 @@ error: * * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set. * + * If you want to copy non-shared storage within migration you + * can use either VIR_MIGRATE_NON_SHARED_DISK or + * VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive. + * * If a hypervisor supports changing the configuration of the guest * during migration, the @dxml parameter specifies the new config * for the guest. The configuration must include an identical set @@ -5799,6 +5842,15 @@ virDomainMigrateToURI2(virDomainPtr domain, goto error; } + if (flags & VIR_MIGRATE_NON_SHARED_DISK && + flags & VIR_MIGRATE_NON_SHARED_INC) { + virReportInvalidArg(flags, + _("flags 'shared disk' and 'shared incremental' " + "in %s are mutually exclusive"), + __FUNCTION__); + goto error; + } + if (flags & VIR_MIGRATE_PEER2PEER) { if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_P2P)) { -- 1.8.1.4

On 02/26/2013 09:27 AM, Michal Privoznik wrote:
These two flags in fact are mutually exclusive. Requesting them both doesn't make any sense regardless of hypervisor driver. Hence, we have to make it within libvirt.c file instead of fixing it in each driver. --- src/libvirt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
ACK, and okay for 1.0.3. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 26.02.2013 18:51, Eric Blake wrote:
On 02/26/2013 09:27 AM, Michal Privoznik wrote:
These two flags in fact are mutually exclusive. Requesting them both doesn't make any sense regardless of hypervisor driver. Hence, we have to make it within libvirt.c file instead of fixing it in each driver. --- src/libvirt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
ACK, and okay for 1.0.3.
Thanks, pushed. Michal
participants (2)
-
Eric Blake
-
Michal Privoznik