virBufferAdjustIndent(buf, 2);
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);
virBufferAddLit(buf, "</vcpus>\n");
unsigned int idx,
qemuDomainObjPrivatePtr priv)
{
+ char *idstr;
char *pidstr;
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")))
goto cleanup;
ret = 0;
cleanup:
+ VIR_FREE(idstr);
VIR_FREE(pidstr);
return ret;
}
virBufferAdjustIndent(buf, 2);
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);
virBufferAddLit(buf, "</vcpus>\n");