---
src/qemu/qemu_driver.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ea4e75b..18169c5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4833,11 +4833,11 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
{
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
+ virDomainDefPtr def;
virDomainDefPtr persistentDef;
int ret = -1;
unsigned int maxvcpus = 0;
virQEMUDriverConfigPtr cfg = NULL;
- virCapsPtr caps = NULL;
qemuAgentCPUInfoPtr cpuinfo = NULL;
int ncpuinfo;
qemuDomainObjPrivatePtr priv;
@@ -4861,20 +4861,15 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (virDomainSetVcpusFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
goto cleanup;
- if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
- goto cleanup;
-
priv = vm->privateData;
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
- if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
- &persistentDef) < 0)
+ if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
goto endjob;
- if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags &
VIR_DOMAIN_VCPU_GUEST) &&
- virNumaIsAvailable()) {
+ if (def && !(flags & VIR_DOMAIN_VCPU_GUEST) &&
virNumaIsAvailable()) {
if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_EMULATOR, 0,
false, &cgroup_temp) < 0)
goto endjob;
@@ -4890,9 +4885,9 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
- if (flags & VIR_DOMAIN_AFFECT_LIVE)
- maxvcpus = vm->def->maxvcpus;
- if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (def)
+ maxvcpus = def->maxvcpus;
+ if (persistentDef) {
if (!maxvcpus || maxvcpus > persistentDef->maxvcpus)
maxvcpus = persistentDef->maxvcpus;
}
@@ -4941,7 +4936,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
} else {
- if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ if (def) {
if (qemuDomainHotplugVcpus(driver, vm, nvcpus) < 0)
goto endjob;
@@ -4949,7 +4944,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
- if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (persistentDef) {
/* remove vcpupin entries for vcpus that were unplugged */
if (nvcpus < persistentDef->vcpus) {
for (i = persistentDef->vcpus - 1; i >= nvcpus; i--)
@@ -4985,7 +4980,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
cleanup:
virDomainObjEndAPI(&vm);
- virObjectUnref(caps);
VIR_FREE(cpuinfo);
VIR_FREE(mem_mask);
VIR_FREE(all_nodes_str);
--
2.4.1