mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
use new macro helpers to check exclusive flags
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
0fb03395a0
commit
ff3f93bcc2
@ -227,18 +227,13 @@ virDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
_("use of 'current' flag in requires 'redefine' flag"));
|
_("use of 'current' flag in requires 'redefine' flag"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) &&
|
|
||||||
(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA,
|
||||||
_("'redefine' and 'no metadata' flags in are mutually exclusive"));
|
error);
|
||||||
goto error;
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
|
||||||
}
|
VIR_DOMAIN_SNAPSHOT_CREATE_HALT,
|
||||||
if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) &&
|
error);
|
||||||
(flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) {
|
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("'redefine' and 'halt' flags are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainSnapshotCreateXML) {
|
if (conn->driver->domainSnapshotCreateXML) {
|
||||||
virDomainSnapshotPtr ret;
|
virDomainSnapshotPtr ret;
|
||||||
@ -1077,12 +1072,9 @@ virDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
|||||||
|
|
||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING,
|
||||||
(flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
|
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("running and paused flags are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainRevertToSnapshot) {
|
if (conn->driver->domainRevertToSnapshot) {
|
||||||
int ret = conn->driver->domainRevertToSnapshot(snapshot, flags);
|
int ret = conn->driver->domainRevertToSnapshot(snapshot, flags);
|
||||||
@ -1137,12 +1129,9 @@ virDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
|
|||||||
|
|
||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN,
|
||||||
(flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)) {
|
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("children and children_only flags are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainSnapshotDelete) {
|
if (conn->driver->domainSnapshotDelete) {
|
||||||
int ret = conn->driver->domainSnapshotDelete(snapshot, flags);
|
int ret = conn->driver->domainSnapshotDelete(snapshot, flags);
|
||||||
|
@ -909,12 +909,9 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
|
|||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
virCheckNonNullArgGoto(to, error);
|
virCheckNonNullArgGoto(to, error);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags & VIR_DOMAIN_SAVE_PAUSED)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_DOMAIN_SAVE_PAUSED,
|
||||||
_("running and paused flags are mutually "
|
error);
|
||||||
"exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainSaveFlags) {
|
if (conn->driver->domainSaveFlags) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -1036,12 +1033,9 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
|
|||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
virCheckNonNullArgGoto(from, error);
|
virCheckNonNullArgGoto(from, error);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags & VIR_DOMAIN_SAVE_PAUSED)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_DOMAIN_SAVE_PAUSED,
|
||||||
_("running and paused flags are mutually "
|
error);
|
||||||
"exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainRestoreFlags) {
|
if (conn->driver->domainRestoreFlags) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -1177,12 +1171,9 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
|
|||||||
virCheckNonNullArgGoto(file, error);
|
virCheckNonNullArgGoto(file, error);
|
||||||
virCheckNonNullArgGoto(dxml, error);
|
virCheckNonNullArgGoto(dxml, error);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags & VIR_DOMAIN_SAVE_PAUSED)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_DOMAIN_SAVE_PAUSED,
|
||||||
_("running and paused flags are mutually "
|
error);
|
||||||
"exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainSaveImageDefineXML) {
|
if (conn->driver->domainSaveImageDefineXML) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -1255,23 +1246,9 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
|
|||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
virCheckNonNullArgGoto(to, error);
|
virCheckNonNullArgGoto(to, error);
|
||||||
|
|
||||||
if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_LIVE, error);
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_RESET, error);
|
||||||
_("crash and live flags are mutually exclusive"));
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_LIVE, VIR_DUMP_RESET, error);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainCoreDump) {
|
if (conn->driver->domainCoreDump) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -1353,23 +1330,9 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_LIVE, error);
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_RESET, error);
|
||||||
_("crash and live flags are mutually exclusive"));
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_LIVE, VIR_DUMP_RESET, error);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainCoreDumpWithFormat) {
|
if (conn->driver->domainCoreDumpWithFormat) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -2174,13 +2137,10 @@ virDomainGetMemoryParameters(virDomainPtr domain,
|
|||||||
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
||||||
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
|
||||||
if (conn->driver->domainGetMemoryParameters) {
|
if (conn->driver->domainGetMemoryParameters) {
|
||||||
@ -2416,13 +2376,10 @@ virDomainGetBlkioParameters(virDomainPtr domain,
|
|||||||
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
||||||
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
|
||||||
if (conn->driver->domainGetBlkioParameters) {
|
if (conn->driver->domainGetBlkioParameters) {
|
||||||
@ -3571,13 +3528,9 @@ virDomainMigrate(virDomainPtr domain,
|
|||||||
virCheckConnectGoto(dconn, error);
|
virCheckConnectGoto(dconn, error);
|
||||||
virCheckReadOnlyGoto(dconn->flags, error);
|
virCheckReadOnlyGoto(dconn->flags, error);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_DISK &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
|
||||||
flags & VIR_MIGRATE_NON_SHARED_INC) {
|
VIR_MIGRATE_NON_SHARED_INC,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'shared disk' and 'shared incremental'"
|
|
||||||
" are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_OFFLINE) {
|
if (flags & VIR_MIGRATE_OFFLINE) {
|
||||||
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
||||||
@ -3799,13 +3752,9 @@ virDomainMigrate2(virDomainPtr domain,
|
|||||||
virCheckConnectGoto(dconn, error);
|
virCheckConnectGoto(dconn, error);
|
||||||
virCheckReadOnlyGoto(dconn->flags, error);
|
virCheckReadOnlyGoto(dconn->flags, error);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_DISK &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
|
||||||
flags & VIR_MIGRATE_NON_SHARED_INC) {
|
VIR_MIGRATE_NON_SHARED_INC,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'shared disk' and 'shared incremental' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_OFFLINE) {
|
if (flags & VIR_MIGRATE_OFFLINE) {
|
||||||
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
||||||
@ -3975,16 +3924,12 @@ virDomainMigrate3(virDomainPtr domain,
|
|||||||
virCheckReadOnlyGoto(domain->conn->flags, error);
|
virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||||
|
|
||||||
/* Now checkout the destination */
|
/* Now checkout the destination */
|
||||||
virCheckConnectGoto(dconn, error);
|
|
||||||
virCheckReadOnlyGoto(dconn->flags, error);
|
virCheckReadOnlyGoto(dconn->flags, error);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_DISK &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
|
||||||
flags & VIR_MIGRATE_NON_SHARED_INC) {
|
VIR_MIGRATE_NON_SHARED_INC,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'shared disk' and 'shared incremental' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
if (flags & VIR_MIGRATE_PEER2PEER) {
|
if (flags & VIR_MIGRATE_PEER2PEER) {
|
||||||
virReportInvalidArg(flags, "%s",
|
virReportInvalidArg(flags, "%s",
|
||||||
_("use virDomainMigrateToURI3 for peer-to-peer "
|
_("use virDomainMigrateToURI3 for peer-to-peer "
|
||||||
@ -4200,13 +4145,9 @@ virDomainMigrateToURI(virDomainPtr domain,
|
|||||||
|
|
||||||
virCheckNonNullArgGoto(duri, error);
|
virCheckNonNullArgGoto(duri, error);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_DISK &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
|
||||||
flags & VIR_MIGRATE_NON_SHARED_INC) {
|
VIR_MIGRATE_NON_SHARED_INC,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'shared disk' and 'shared incremental' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_OFFLINE &&
|
if (flags & VIR_MIGRATE_OFFLINE &&
|
||||||
!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
||||||
@ -4359,13 +4300,9 @@ virDomainMigrateToURI2(virDomainPtr domain,
|
|||||||
virCheckDomainReturn(domain, -1);
|
virCheckDomainReturn(domain, -1);
|
||||||
virCheckReadOnlyGoto(domain->conn->flags, error);
|
virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_DISK &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
|
||||||
flags & VIR_MIGRATE_NON_SHARED_INC) {
|
VIR_MIGRATE_NON_SHARED_INC,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'shared disk' and 'shared incremental' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_PEER2PEER) {
|
if (flags & VIR_MIGRATE_PEER2PEER) {
|
||||||
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
||||||
@ -4467,13 +4404,9 @@ virDomainMigrateToURI3(virDomainPtr domain,
|
|||||||
virCheckDomainReturn(domain, -1);
|
virCheckDomainReturn(domain, -1);
|
||||||
virCheckReadOnlyGoto(domain->conn->flags, error);
|
virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_DISK &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
|
||||||
flags & VIR_MIGRATE_NON_SHARED_INC) {
|
VIR_MIGRATE_NON_SHARED_INC,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'shared disk' and 'shared incremental' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
compat = virTypedParamsCheck(params, nparams, compatParams,
|
compat = virTypedParamsCheck(params, nparams, compatParams,
|
||||||
ARRAY_CARDINALITY(compatParams));
|
ARRAY_CARDINALITY(compatParams));
|
||||||
@ -5510,14 +5443,10 @@ virDomainGetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
||||||
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' in "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
|
||||||
if (conn->driver->domainGetSchedulerParametersFlags) {
|
if (conn->driver->domainGetSchedulerParametersFlags) {
|
||||||
@ -6278,13 +6207,7 @@ virDomainMemoryPeek(virDomainPtr dom,
|
|||||||
* because of incompatible licensing.
|
* because of incompatible licensing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exactly one of these two flags must be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MEMORY_VIRTUAL, VIR_MEMORY_PHYSICAL, error);
|
||||||
if (!(flags & VIR_MEMORY_VIRTUAL) == !(flags & VIR_MEMORY_PHYSICAL)) {
|
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags must include VIR_MEMORY_VIRTUAL or "
|
|
||||||
"VIR_MEMORY_PHYSICAL"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allow size == 0 as an access test. */
|
/* Allow size == 0 as an access test. */
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
@ -7322,14 +7245,9 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
|||||||
virCheckDomainReturn(domain, -1);
|
virCheckDomainReturn(domain, -1);
|
||||||
virCheckReadOnlyGoto(domain->conn->flags, error);
|
virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_VCPU_GUEST &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_VCPU_GUEST,
|
||||||
flags & VIR_DOMAIN_VCPU_MAXIMUM) {
|
VIR_DOMAIN_VCPU_MAXIMUM,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'VIR_DOMAIN_VCPU_MAXIMUM' and "
|
|
||||||
"'VIR_DOMAIN_VCPU_GUEST' in are mutually "
|
|
||||||
"exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
virCheckNonZeroArgGoto(nvcpus, error);
|
virCheckNonZeroArgGoto(nvcpus, error);
|
||||||
|
|
||||||
@ -7398,14 +7316,9 @@ virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
if (flags & VIR_DOMAIN_VCPU_GUEST)
|
if (flags & VIR_DOMAIN_VCPU_GUEST)
|
||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainGetVcpusFlags) {
|
if (conn->driver->domainGetVcpusFlags) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -7603,14 +7516,9 @@ virDomainGetVcpuPinInfo(virDomainPtr domain, int ncpumaps,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainGetVcpuPinInfo) {
|
if (conn->driver->domainGetVcpuPinInfo) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -7732,14 +7640,10 @@ virDomainGetEmulatorPinInfo(virDomainPtr domain, unsigned char *cpumap,
|
|||||||
virCheckNonNullArgGoto(cpumap, error);
|
virCheckNonNullArgGoto(cpumap, error);
|
||||||
virCheckPositiveArgGoto(maplen, error);
|
virCheckPositiveArgGoto(maplen, error);
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
|
||||||
if (conn->driver->domainGetEmulatorPinInfo) {
|
if (conn->driver->domainGetEmulatorPinInfo) {
|
||||||
@ -7901,14 +7805,9 @@ virDomainGetIOThreadInfo(virDomainPtr dom,
|
|||||||
virCheckNonNullArgGoto(info, error);
|
virCheckNonNullArgGoto(info, error);
|
||||||
*info = NULL;
|
*info = NULL;
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dom->conn->driver->domainGetIOThreadInfo) {
|
if (dom->conn->driver->domainGetIOThreadInfo) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -8352,13 +8251,9 @@ virDomainGetMetadata(virDomainPtr domain,
|
|||||||
|
|
||||||
virCheckDomainReturn(domain, NULL);
|
virCheckDomainReturn(domain, NULL);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
virReportInvalidArg(flags, "%s",
|
error);
|
||||||
_("flags 'affect live' and 'affect config' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VIR_DOMAIN_METADATA_TITLE:
|
case VIR_DOMAIN_METADATA_TITLE:
|
||||||
@ -9403,12 +9298,9 @@ virDomainManagedSave(virDomainPtr dom, unsigned int flags)
|
|||||||
|
|
||||||
virCheckReadOnlyGoto(conn->flags, error);
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags & VIR_DOMAIN_SAVE_PAUSED)) {
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
|
||||||
virReportInvalidArg(flags, "%s",
|
VIR_DOMAIN_SAVE_PAUSED,
|
||||||
_("running and paused flags are mutually "
|
error);
|
||||||
"exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->driver->domainManagedSave) {
|
if (conn->driver->domainManagedSave) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -10578,14 +10470,10 @@ virDomainGetBlockIoTune(virDomainPtr dom,
|
|||||||
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
|
||||||
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
flags |= VIR_TYPED_PARAM_STRING_OKAY;
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
|
||||||
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
error);
|
||||||
virReportInvalidArg(flags, "%s",
|
|
||||||
_("flags 'affect live' and 'affect config' "
|
|
||||||
"are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
conn = dom->conn;
|
conn = dom->conn;
|
||||||
|
|
||||||
if (conn->driver->domainGetBlockIoTune) {
|
if (conn->driver->domainGetBlockIoTune) {
|
||||||
|
@ -441,13 +441,9 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
||||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
|
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
|
||||||
|
|
||||||
if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_STORAGE_POOL_BUILD_OVERWRITE,
|
||||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
|
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE,
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
error);
|
||||||
_("Overwrite and no overwrite flags"
|
|
||||||
" are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIR_STORAGE_POOL_BUILD_OVERWRITE) {
|
if (flags & VIR_STORAGE_POOL_BUILD_OVERWRITE) {
|
||||||
ok_to_mklabel = true;
|
ok_to_mklabel = true;
|
||||||
|
@ -773,14 +773,9 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
||||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
|
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
|
||||||
|
|
||||||
if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_STORAGE_POOL_BUILD_OVERWRITE,
|
||||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
|
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE,
|
||||||
|
error);
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
||||||
_("Overwrite and no overwrite flags"
|
|
||||||
" are mutually exclusive"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VIR_STRDUP(parent, pool->def->target.path) < 0)
|
if (VIR_STRDUP(parent, pool->def->target.path) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user