mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 05:57:16 +00:00
qemu: domain: Store and restore autoCpuset to status XML
Decouple them by storing them in the XML separately rather than regenerating them. This will simplify upcoming fixes.
This commit is contained in:
parent
2dda319a9f
commit
95d5601018
@ -1765,20 +1765,30 @@ qemuDomainObjPtrivateXMLFormatAutomaticPlacement(virBufferPtr buf,
|
|||||||
qemuDomainObjPrivatePtr priv)
|
qemuDomainObjPrivatePtr priv)
|
||||||
{
|
{
|
||||||
char *nodeset = NULL;
|
char *nodeset = NULL;
|
||||||
|
char *cpuset = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!priv->autoNodeset)
|
if (!priv->autoNodeset && !priv->autoCpuset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(nodeset = virBitmapFormat(priv->autoNodeset)))
|
if (priv->autoNodeset &&
|
||||||
|
!((nodeset = virBitmapFormat(priv->autoNodeset))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virBufferAsprintf(buf, "<numad nodeset='%s'/>\n", nodeset);
|
if (priv->autoCpuset &&
|
||||||
|
!((cpuset = virBitmapFormat(priv->autoCpuset))))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
virBufferAddLit(buf, "<numad");
|
||||||
|
virBufferEscapeString(buf, " nodeset='%s'", nodeset);
|
||||||
|
virBufferEscapeString(buf, " cpuset='%s'", cpuset);
|
||||||
|
virBufferAddLit(buf, "/>\n");
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(nodeset);
|
VIR_FREE(nodeset);
|
||||||
|
VIR_FREE(cpuset);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1958,28 +1968,39 @@ qemuDomainObjPrivateXMLParseAutomaticPlacement(xmlXPathContextPtr ctxt,
|
|||||||
{
|
{
|
||||||
virCapsPtr caps = NULL;
|
virCapsPtr caps = NULL;
|
||||||
char *nodeset;
|
char *nodeset;
|
||||||
|
char *cpuset;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
nodeset = virXPathString("string(./numad/@nodeset)", ctxt);
|
nodeset = virXPathString("string(./numad/@nodeset)", ctxt);
|
||||||
|
cpuset = virXPathString("string(./numad/@cpuset)", ctxt);
|
||||||
|
|
||||||
if (!nodeset)
|
if (!nodeset && !cpuset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virBitmapParse(nodeset, &priv->autoNodeset, caps->host.nnumaCell_max) < 0)
|
if (nodeset &&
|
||||||
|
virBitmapParse(nodeset, &priv->autoNodeset, caps->host.nnumaCell_max) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
|
if (cpuset) {
|
||||||
priv->autoNodeset)))
|
if (virBitmapParse(cpuset, &priv->autoCpuset, VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
} else {
|
||||||
|
/* autoNodeset is present in this case, since otherwise we wouldn't
|
||||||
|
* reach this code */
|
||||||
|
if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
|
||||||
|
priv->autoNodeset)))
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
VIR_FREE(nodeset);
|
VIR_FREE(nodeset);
|
||||||
|
VIR_FREE(cpuset);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ static const char testStatusXMLPrefixFooter[] =
|
|||||||
" <device alias='net0'/>\n"
|
" <device alias='net0'/>\n"
|
||||||
" <device alias='usb'/>\n"
|
" <device alias='usb'/>\n"
|
||||||
" </devices>\n"
|
" </devices>\n"
|
||||||
" <numad nodeset='0-2'/>\n"
|
" <numad nodeset='0-2' cpuset='1,3'/>\n"
|
||||||
" <libDir path='/tmp'/>\n"
|
" <libDir path='/tmp'/>\n"
|
||||||
" <channelTargetDir path='/tmp/channel'/>\n";
|
" <channelTargetDir path='/tmp/channel'/>\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user