mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs
This commit is contained in:
parent
7721e7901f
commit
582e8cb908
@ -5202,13 +5202,11 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
|
|||||||
int maplen,
|
int maplen,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
||||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
|
||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
virDomainDefPtr targetDef = NULL;
|
virDomainDefPtr def;
|
||||||
|
virDomainDefPtr targetDef;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int hostcpus, vcpu;
|
int hostcpus, vcpu;
|
||||||
virCapsPtr caps = NULL;
|
|
||||||
virBitmapPtr allcpumap = NULL;
|
virBitmapPtr allcpumap = NULL;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||||
@ -5220,18 +5218,11 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
|
|||||||
if (virDomainGetVcpuPinInfoEnsureACL(dom->conn, vm->def) < 0)
|
if (virDomainGetVcpuPinInfoEnsureACL(dom->conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
if (virDomainObjGetDefs(vm, flags, &def, &targetDef) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
|
if (def)
|
||||||
&targetDef) < 0)
|
targetDef = def;
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
|
||||||
targetDef = vm->def;
|
|
||||||
|
|
||||||
/* Coverity didn't realize that targetDef must be set if we got here. */
|
|
||||||
sa_assert(targetDef);
|
|
||||||
|
|
||||||
if ((hostcpus = nodeGetCPUCount()) < 0)
|
if ((hostcpus = nodeGetCPUCount()) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5269,7 +5260,6 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
|
|||||||
cleanup:
|
cleanup:
|
||||||
virBitmapFree(allcpumap);
|
virBitmapFree(allcpumap);
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virObjectUnref(caps);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user