if (rc == 0)
goto unsupported;
if (rc < 0)
- goto cleanup;
+ goto exit_monitor;
vcpus++;
}
if (rc == 0)
goto unsupported;
if (rc < 0)
- goto cleanup;
+ goto exit_monitor;
vcpus--;
}
* fatal */
if ((ncpupids = qemuMonitorGetCPUInfo(priv->mon, &cpupids)) <= 0) {
virResetLastError();
+ goto exit_monitor;
+ }
+ if (qemuDomainObjExitMonitor(driver, vm) < 0) {
+ ret = -1;
goto cleanup;
}
cpupids = NULL;
cleanup:
- qemuDomainObjExitMonitor(driver, vm);
- vm->def->vcpus = vcpus;
VIR_FREE(cpupids);
VIR_FREE(mem_mask);
+ if (virDomainObjIsActive(vm))
+ vm->def->vcpus = vcpus;
virDomainAuditVcpu(vm, oldvcpus, nvcpus, "update", rc == 1);
if (cgroup_vcpu)
virCgroupFree(&cgroup_vcpu);
unsupported:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot change vcpu count of this domain"));
+ exit_monitor:
+ ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}