mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: move virDomainLiveConfigHelperMethod right after BeginJob
We should call virDomainLiveConfigHelperMethod ASAP because this function transfers VIR_DOMAIN_AFFECT_CURRENT to VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG. All other additional checks for those two flags should consider that the user give us VIR_DOMAIN_AFFECT_CURRENT. Remove the unnecessary check whether the domain is live in case of VIR_DOMAIN_VCPU_GUEST because this check is done by virDomainLiveConfigHelperMethod. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
7c8ae42d49
commit
5bb0666545
@ -4887,6 +4887,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
|
||||
&persistentDef) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags & VIR_DOMAIN_VCPU_GUEST)) {
|
||||
if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
|
||||
goto endjob;
|
||||
@ -4905,10 +4909,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
maximum = (flags & VIR_DOMAIN_VCPU_MAXIMUM) != 0;
|
||||
flags &= ~VIR_DOMAIN_VCPU_MAXIMUM;
|
||||
|
||||
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
|
||||
&persistentDef) < 0)
|
||||
goto endjob;
|
||||
|
||||
/* MAXIMUM cannot be mixed with LIVE. */
|
||||
if (maximum && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
@ -4956,12 +4956,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
if (ncpuinfo < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("domain is not running"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0)
|
||||
goto endjob;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user