mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-23 03:42:19 +00:00
qemu: Add cpu ID to the vCPU pid list in the status XML
Note the vcpu ID so that once we allow non-contiguous vCPU topologies it will be possible to pair thread id's with the vcpus.
This commit is contained in:
parent
b91335afe4
commit
3f57ce4a76
@ -1337,7 +1337,7 @@ qemuDomainObjPrivateXMLFormatVcpus(virBufferPtr buf,
|
|||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
|
||||||
for (i = 0; i < nvcpupids; i++)
|
for (i = 0; i < nvcpupids; i++)
|
||||||
virBufferAsprintf(buf, "<vcpu pid='%d'/>\n", vcpupids[i]);
|
virBufferAsprintf(buf, "<vcpu id='%zu' pid='%d'/>\n", i, vcpupids[i]);
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</vcpus>\n");
|
virBufferAddLit(buf, "</vcpus>\n");
|
||||||
@ -1466,9 +1466,19 @@ qemuDomainObjPrivateXMLParseVcpu(xmlNodePtr node,
|
|||||||
unsigned int idx,
|
unsigned int idx,
|
||||||
qemuDomainObjPrivatePtr priv)
|
qemuDomainObjPrivatePtr priv)
|
||||||
{
|
{
|
||||||
|
char *idstr;
|
||||||
char *pidstr;
|
char *pidstr;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
if ((idstr = virXMLPropString(node, "id"))) {
|
||||||
|
if (virStrToLong_uip(idstr, NULL, 10, &idx) < 0 ||
|
||||||
|
idx >= priv->nvcpupids) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("invalid vcpu index '%s'"), idstr);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(pidstr = virXMLPropString(node, "pid")))
|
if (!(pidstr = virXMLPropString(node, "pid")))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1478,6 +1488,7 @@ qemuDomainObjPrivateXMLParseVcpu(xmlNodePtr node,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
VIR_FREE(idstr);
|
||||||
VIR_FREE(pidstr);
|
VIR_FREE(pidstr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,8 @@ testGetStatuXMLPrefixVcpus(virBufferPtr buf,
|
|||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
|
||||||
while ((vcpuid = virBitmapNextSetBit(data->activeVcpus, vcpuid)) >= 0)
|
while ((vcpuid = virBitmapNextSetBit(data->activeVcpus, vcpuid)) >= 0)
|
||||||
virBufferAsprintf(buf, "<vcpu pid='%zd'/>\n", vcpuid + 3803519);
|
virBufferAsprintf(buf, "<vcpu id='%zd' pid='%zd'/>\n",
|
||||||
|
vcpuid, vcpuid + 3803519);
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</vcpus>\n");
|
virBufferAddLit(buf, "</vcpus>\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user