qemu_domain: Add niothreadpids and iothreadpids

Add new 'niothreadpids' and 'iothreadpids' to mimic the 'ncpupids' and
'vcpupids' that already exist.
This commit is contained in:
John Ferlan 2014-09-03 09:06:52 -04:00
parent 3abb95cad4
commit 586905512a
2 changed files with 39 additions and 0 deletions

View File

@ -425,6 +425,7 @@ qemuDomainObjPrivateFree(void *data)
virDomainChrSourceDefFree(priv->monConfig);
qemuDomainObjFreeJob(priv);
VIR_FREE(priv->vcpupids);
VIR_FREE(priv->iothreadpids);
VIR_FREE(priv->lockState);
VIR_FREE(priv->origname);
@ -483,6 +484,18 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
virBufferAddLit(buf, "</vcpus>\n");
}
if (priv->niothreadpids) {
size_t i;
virBufferAddLit(buf, "<iothreads>\n");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < priv->niothreadpids; i++) {
virBufferAsprintf(buf, "<iothread pid='%d'/>\n",
priv->iothreadpids[i]);
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</iothreads>\n");
}
if (priv->qemuCaps) {
size_t i;
virBufferAddLit(buf, "<qemuCaps>\n");
@ -606,6 +619,29 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
VIR_FREE(nodes);
}
n = virXPathNodeSet("./iothreads/iothread", ctxt, &nodes);
if (n < 0)
goto error;
if (n) {
priv->niothreadpids = n;
if (VIR_REALLOC_N(priv->iothreadpids, priv->niothreadpids) < 0)
goto error;
for (i = 0; i < n; i++) {
char *pidstr = virXMLPropString(nodes[i], "pid");
if (!pidstr)
goto error;
if (virStrToLong_i(pidstr, NULL, 10,
&(priv->iothreadpids[i])) < 0) {
VIR_FREE(pidstr);
goto error;
}
VIR_FREE(pidstr);
}
VIR_FREE(nodes);
}
if ((n = virXPathNodeSet("./qemuCaps/flag", ctxt, &nodes)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to parse qemu capabilities flags"));

View File

@ -154,6 +154,9 @@ struct _qemuDomainObjPrivate {
int nvcpupids;
int *vcpupids;
int niothreadpids;
int *iothreadpids;
virDomainPCIAddressSetPtr pciaddrs;
virDomainCCWAddressSetPtr ccwaddrs;
int persistentAddrs;