Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/libvirt-domain-snapshot.c | 45 ++----
src/libvirt-domain.c | 288 +++++++++++--------------------------
src/qemu/qemu_driver.c | 9 +-
src/storage/storage_backend_disk.c | 10 +-
src/storage/storage_backend_fs.c | 11 +-
5 files changed, 106 insertions(+), 257 deletions(-)
diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c
index 9feb669..0d5c5e8 100644
--- a/src/libvirt-domain-snapshot.c
+++ b/src/libvirt-domain-snapshot.c
@@ -228,22 +228,13 @@ virDomainSnapshotCreateXML(virDomainPtr domain,
__FUNCTION__);
goto error;
}
- if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) &&
- (flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
- virReportInvalidArg(flags,
- _("'redefine' and 'no metadata' flags in
%s are "
- "mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
- if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) &&
- (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) {
- virReportInvalidArg(flags,
- _("'redefine' and 'halt' flags in %s are
mutually "
- "exclusive"),
- __FUNCTION__);
- goto error;
- }
+
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
+ VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA,
+ error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
+ VIR_DOMAIN_SNAPSHOT_CREATE_HALT,
+ error);
if (conn->driver->domainSnapshotCreateXML) {
virDomainSnapshotPtr ret;
@@ -1082,14 +1073,9 @@ virDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virCheckReadOnlyGoto(conn->flags, error);
- if ((flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) &&
- (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
- virReportInvalidArg(flags,
- _("running and paused flags in %s are mutually "
- "exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING,
+ VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED,
+ error);
if (conn->driver->domainRevertToSnapshot) {
int ret = conn->driver->domainRevertToSnapshot(snapshot, flags);
@@ -1144,14 +1130,9 @@ virDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
virCheckReadOnlyGoto(conn->flags, error);
- if ((flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) &&
- (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)) {
- virReportInvalidArg(flags,
- _("children and children_only flags in %s are "
- "mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN,
+ VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY,
+ error);
if (conn->driver->domainSnapshotDelete) {
int ret = conn->driver->domainSnapshotDelete(snapshot, flags);
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 0bd9274..5482c70 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -911,12 +911,9 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
virCheckReadOnlyGoto(conn->flags, error);
virCheckNonNullArgGoto(to, error);
- if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags &
VIR_DOMAIN_SAVE_PAUSED)) {
- virReportInvalidArg(flags, "%s",
- _("running and paused flags are mutually "
- "exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
+ VIR_DOMAIN_SAVE_PAUSED,
+ error);
if (conn->driver->domainSaveFlags) {
int ret;
@@ -1038,12 +1035,9 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const
char *dxml,
virCheckReadOnlyGoto(conn->flags, error);
virCheckNonNullArgGoto(from, error);
- if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags &
VIR_DOMAIN_SAVE_PAUSED)) {
- virReportInvalidArg(flags, "%s",
- _("running and paused flags are mutually "
- "exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
+ VIR_DOMAIN_SAVE_PAUSED,
+ error);
if (conn->driver->domainRestoreFlags) {
int ret;
@@ -1179,12 +1173,9 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
virCheckNonNullArgGoto(file, error);
virCheckNonNullArgGoto(dxml, error);
- if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags &
VIR_DOMAIN_SAVE_PAUSED)) {
- virReportInvalidArg(flags, "%s",
- _("running and paused flags are mutually "
- "exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
+ VIR_DOMAIN_SAVE_PAUSED,
+ error);
if (conn->driver->domainSaveImageDefineXML) {
int ret;
@@ -1257,23 +1248,9 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int
flags)
virCheckReadOnlyGoto(conn->flags, error);
virCheckNonNullArgGoto(to, error);
- if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) {
- virReportInvalidArg(flags, "%s",
- _("crash and live flags are mutually exclusive"));
- goto error;
- }
-
- if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_RESET)) {
- virReportInvalidArg(flags, "%s",
- _("crash and reset flags are mutually exclusive"));
- goto error;
- }
-
- if ((flags & VIR_DUMP_LIVE) && (flags & VIR_DUMP_RESET)) {
- virReportInvalidArg(flags, "%s",
- _("live and reset flags are mutually exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_LIVE, error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_RESET, error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_LIVE, VIR_DUMP_RESET, error);
if (conn->driver->domainCoreDump) {
int ret;
@@ -1355,23 +1332,9 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to,
goto error;
}
- if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) {
- virReportInvalidArg(flags, "%s",
- _("crash and live flags are mutually exclusive"));
- goto error;
- }
-
- if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_RESET)) {
- virReportInvalidArg(flags, "%s",
- _("crash and reset flags are mutually
exclusive"));
- goto error;
- }
-
- if ((flags & VIR_DUMP_LIVE) && (flags & VIR_DUMP_RESET)) {
- virReportInvalidArg(flags, "%s",
- _("live and reset flags are mutually exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_LIVE, error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_RESET, error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_LIVE, VIR_DUMP_RESET, error);
if (conn->driver->domainCoreDumpWithFormat) {
int ret;
@@ -2176,15 +2139,10 @@ virDomainGetMemoryParameters(virDomainPtr domain,
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
flags |= VIR_TYPED_PARAM_STRING_OKAY;
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+
conn = domain->conn;
if (conn->driver->domainGetMemoryParameters) {
@@ -2420,15 +2378,10 @@ virDomainGetBlkioParameters(virDomainPtr domain,
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
flags |= VIR_TYPED_PARAM_STRING_OKAY;
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+
conn = domain->conn;
if (conn->driver->domainGetBlkioParameters) {
@@ -3578,14 +3531,9 @@ virDomainMigrate(virDomainPtr domain,
virCheckConnectGoto(dconn, error);
virCheckReadOnlyGoto(dconn->flags, 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;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
+ VIR_MIGRATE_NON_SHARED_INC,
+ error);
if (flags & VIR_MIGRATE_OFFLINE) {
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
@@ -3807,14 +3755,9 @@ virDomainMigrate2(virDomainPtr domain,
virCheckConnectGoto(dconn, error);
virCheckReadOnlyGoto(dconn->flags, 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;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
+ VIR_MIGRATE_NON_SHARED_INC,
+ error);
if (flags & VIR_MIGRATE_OFFLINE) {
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
@@ -3987,14 +3930,10 @@ virDomainMigrate3(virDomainPtr domain,
virCheckConnectGoto(dconn, error);
virCheckReadOnlyGoto(dconn->flags, 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;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
+ VIR_MIGRATE_NON_SHARED_INC,
+ error);
+
if (flags & VIR_MIGRATE_PEER2PEER) {
virReportInvalidArg(flags, "%s",
_("use virDomainMigrateToURI3 for peer-to-peer "
@@ -4210,14 +4149,9 @@ 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;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
+ VIR_MIGRATE_NON_SHARED_INC,
+ error);
if (flags & VIR_MIGRATE_OFFLINE &&
!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
@@ -4370,14 +4304,9 @@ virDomainMigrateToURI2(virDomainPtr domain,
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, 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;
- }
+ 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,
@@ -4479,14 +4408,9 @@ virDomainMigrateToURI3(virDomainPtr domain,
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, 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;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
+ VIR_MIGRATE_NON_SHARED_INC,
+ error);
compat = virTypedParamsCheck(params, nparams, compatParams,
ARRAY_CARDINALITY(compatParams));
@@ -5526,15 +5450,10 @@ virDomainGetSchedulerParametersFlags(virDomainPtr domain,
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
flags |= VIR_TYPED_PARAM_STRING_OKAY;
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+
conn = domain->conn;
if (conn->driver->domainGetSchedulerParametersFlags) {
@@ -6295,14 +6214,7 @@ virDomainMemoryPeek(virDomainPtr dom,
* because of incompatible licensing.
*/
- /* Exactly one of these two flags must be set. */
- if (!(flags & VIR_MEMORY_VIRTUAL) == !(flags & VIR_MEMORY_PHYSICAL)) {
- virReportInvalidArg(flags,
- _("flags in %s must include VIR_MEMORY_VIRTUAL or
"
- "VIR_MEMORY_PHYSICAL"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MEMORY_VIRTUAL, VIR_MEMORY_PHYSICAL, error);
/* Allow size == 0 as an access test. */
if (size > 0)
@@ -7340,14 +7252,21 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, error);
- if (flags & VIR_DOMAIN_VCPU_GUEST &&
- flags & VIR_DOMAIN_VCPU_MAXIMUM) {
- virReportInvalidArg(flags,
- _("flags 'VIR_DOMAIN_VCPU_MAXIMUM' and "
- "'VIR_DOMAIN_VCPU_GUEST' in '%s' are
mutually "
- "exclusive"), __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_CURRENT,
+ VIR_DOMAIN_AFFECT_LIVE,
+ error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_CURRENT,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_VCPU_GUEST,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_VCPU_GUEST,
+ VIR_DOMAIN_VCPU_MAXIMUM,
+ error);
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_CONFIG,
+ VIR_DOMAIN_VCPU_MAXIMUM,
+ error);
virCheckNonZeroArgGoto(nvcpus, error);
@@ -7416,15 +7335,9 @@ virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
if (flags & VIR_DOMAIN_VCPU_GUEST)
virCheckReadOnlyGoto(conn->flags, error);
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
if (conn->driver->domainGetVcpusFlags) {
int ret;
@@ -7622,15 +7535,9 @@ virDomainGetVcpuPinInfo(virDomainPtr domain, int ncpumaps,
goto error;
}
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
if (conn->driver->domainGetVcpuPinInfo) {
int ret;
@@ -7752,15 +7659,10 @@ virDomainGetEmulatorPinInfo(virDomainPtr domain, unsigned char
*cpumap,
virCheckNonNullArgGoto(cpumap, error);
virCheckPositiveArgGoto(maplen, error);
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+
conn = domain->conn;
if (conn->driver->domainGetEmulatorPinInfo) {
@@ -7922,15 +7824,9 @@ virDomainGetIOThreadsInfo(virDomainPtr dom,
virCheckNonNullArgGoto(info, error);
*info = NULL;
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
if (dom->conn->driver->domainGetIOThreadsInfo) {
int ret;
@@ -8257,14 +8153,9 @@ virDomainGetMetadata(virDomainPtr domain,
virCheckDomainReturn(domain, NULL);
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
switch (type) {
case VIR_DOMAIN_METADATA_TITLE:
@@ -9309,13 +9200,9 @@ virDomainManagedSave(virDomainPtr dom, unsigned int flags)
virCheckReadOnlyGoto(conn->flags, error);
- if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags &
VIR_DOMAIN_SAVE_PAUSED)) {
- virReportInvalidArg(flags,
- _("running and paused flags in %s are mutually "
- "exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
+ VIR_DOMAIN_SAVE_PAUSED,
+ error);
if (conn->driver->domainManagedSave) {
int ret;
@@ -10486,15 +10373,10 @@ virDomainGetBlockIoTune(virDomainPtr dom,
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
flags |= VIR_TYPED_PARAM_STRING_OKAY;
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
- (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
- virReportInvalidArg(flags,
- _("flags 'affect live' and 'affect
config' in %s "
- "are mutually exclusive"),
- __FUNCTION__);
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
+ VIR_DOMAIN_AFFECT_CONFIG,
+ error);
+
conn = dom->conn;
if (conn->driver->domainGetBlockIoTune) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6d9217b..cc6656d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2015,13 +2015,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN |
VIR_DOMAIN_REBOOT_GUEST_AGENT, -1);
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
- (flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
- virReportInvalidArg(flags, "%s",
- _("flags for acpi power button and guest agent are
mutually exclusive"));
- return -1;
- }
+ VIR_EXCLUSIVE_FLAGS_RET(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN,
+ VIR_DOMAIN_REBOOT_GUEST_AGENT);
if (!(vm = qemuDomObjFromDomain(dom)))
goto cleanup;
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index ba928d8..3689e8e 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -441,13 +441,9 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
- if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
- VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Overwrite and no overwrite flags"
- " are mutually exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_STORAGE_POOL_BUILD_OVERWRITE,
+ VIR_STORAGE_POOL_BUILD_NO_OVERWRITE,
+ error);
if (flags & VIR_STORAGE_POOL_BUILD_OVERWRITE) {
ok_to_mklabel = true;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 35385db..9ce97d6 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -774,14 +774,9 @@ virStorageBackendFileSystemBuild(virConnectPtr conn
ATTRIBUTE_UNUSED,
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
- if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
- VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
-
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Overwrite and no overwrite flags"
- " are mutually exclusive"));
- goto error;
- }
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_STORAGE_POOL_BUILD_OVERWRITE,
+ VIR_STORAGE_POOL_BUILD_NO_OVERWRITE,
+ error);
if (VIR_STRDUP(parent, pool->def->target.path) < 0)
goto error;
--
2.0.5