On Fri, Mar 20, 2015 at 15:39:00 +0100, Pavel Hrdina wrote:
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(-)
@@ -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);
By the way, this check here is not enough to check that MAXIMUM is not
actually used with _AFFECT_LIVE.
If you use VIR_DOMAIN_AFFECT_CURRENT and the guest is online, this check
is bypassed as the state of the domain is not known at this point.
This unfortunately needs to be checked after the
virDomainLiveConfigHelperMethod in the actual code.
virCheckNonZeroArgGoto(nvcpus, error);
Peter