qemu: cleanup setvcpus

Remove unnecessary maximum variable.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2015-03-24 18:22:27 +01:00
parent 5bb0666545
commit 5cd3c5012d

View File

@ -4846,7 +4846,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
virDomainObjPtr vm = NULL; virDomainObjPtr vm = NULL;
virDomainDefPtr persistentDef; virDomainDefPtr persistentDef;
int ret = -1; int ret = -1;
bool maximum;
unsigned int maxvcpus = 0; unsigned int maxvcpus = 0;
virQEMUDriverConfigPtr cfg = NULL; virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL; virCapsPtr caps = NULL;
@ -4906,13 +4905,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob; goto endjob;
} }
maximum = (flags & VIR_DOMAIN_VCPU_MAXIMUM) != 0;
flags &= ~VIR_DOMAIN_VCPU_MAXIMUM;
/* MAXIMUM cannot be mixed with LIVE. */ /* MAXIMUM cannot be mixed with LIVE. */
if (maximum && (flags & VIR_DOMAIN_AFFECT_LIVE)) { if ((flags & VIR_DOMAIN_VCPU_MAXIMUM) && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("cannot adjust maximum on running domain")); _("cannot adjust maximum vcpus on running domain"));
goto endjob; goto endjob;
} }
@ -4922,7 +4918,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (!maxvcpus || maxvcpus > persistentDef->maxvcpus) if (!maxvcpus || maxvcpus > persistentDef->maxvcpus)
maxvcpus = persistentDef->maxvcpus; maxvcpus = persistentDef->maxvcpus;
} }
if (!maximum && nvcpus > maxvcpus) { if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM) && nvcpus > maxvcpus) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("requested vcpus is greater than max allowable" _("requested vcpus is greater than max allowable"
" vcpus for the domain: %d > %d"), " vcpus for the domain: %d > %d"),
@ -4933,8 +4929,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (flags & VIR_DOMAIN_VCPU_GUEST) { if (flags & VIR_DOMAIN_VCPU_GUEST) {
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("changing of maximum vCPU count isn't supported " _("setting vcpus via guest agent isn't supported "
"via guest agent")); "on offline domain"));
goto endjob; goto endjob;
} }
@ -4991,7 +4987,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
i); i);
} }
if (maximum) { if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
persistentDef->maxvcpus = nvcpus; persistentDef->maxvcpus = nvcpus;
if (nvcpus < persistentDef->vcpus) if (nvcpus < persistentDef->vcpus)
persistentDef->vcpus = nvcpus; persistentDef->vcpus = nvcpus;