提交 f2ad7824 编写于 作者: D Daniel P. Berrange

Save vcpuinfo in status file

* src/qemu_driver.c: Don't trust monitor for vcpu PID info on
  restart
* src/domain_conf.c: Save and load vCPU PID info from domain
  status file
上级 61a70716
......@@ -3061,6 +3061,8 @@ static virDomainObjPtr virDomainObjParseXML(virConnectPtr conn,
xmlNodePtr oldnode;
virDomainObjPtr obj;
char *monitorpath;
xmlNodePtr *nodes = NULL;
int n, i;
if (!(obj = virDomainObjNew(conn)))
return NULL;
......@@ -3133,9 +3135,32 @@ static virDomainObjPtr virDomainObjParseXML(virConnectPtr conn,
break;
}
n = virXPathNodeSet(conn, "./vcpus/vcpu", ctxt, &nodes);
if (n < 0)
goto error;
if (n) {
obj->nvcpupids = n;
if (VIR_REALLOC_N(obj->vcpupids, obj->nvcpupids) < 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, &(obj->vcpupids[i])) < 0) {
VIR_FREE(pidstr);
goto error;
}
VIR_FREE(pidstr);
}
VIR_FREE(nodes);
}
return obj;
error:
VIR_FREE(nodes);
virDomainChrDefFree(obj->monitor_chr);
virDomainObjFree(obj);
return NULL;
......@@ -4422,6 +4447,16 @@ char *virDomainObjFormat(virConnectPtr conn,
virBufferVSprintf(&buf, " type='%s'/>\n",
virDomainChrTypeToString(obj->monitor_chr->type));
if (obj->nvcpupids) {
int i;
virBufferAddLit(&buf, " <vcpus>\n");
for (i = 0 ; i < obj->nvcpupids ; i++) {
virBufferVSprintf(&buf, " <vcpu pid='%d'/>\n", obj->vcpupids[i]);
}
virBufferAddLit(&buf, " </vcpus>\n");
}
if (!(config_xml = virDomainDefFormat(conn,
obj->def,
flags)))
......
......@@ -336,10 +336,6 @@ qemuReconnectDomain(struct qemud_driver *driver,
goto error;
}
if (qemudDetectVcpuPIDs(NULL, obj) < 0) {
goto error;
}
if (qemuUpdateActivePciHostdevs(driver, obj->def) < 0) {
goto error;
}
......@@ -2519,6 +2515,7 @@ qemudMonitorCommandWithHandler(const virDomainObjPtr vm,
qemuMonitorDiscardPendingData(vm);
VIR_DEBUG("Send '%s'", cmd);
if (qemudMonitorSend(vm, cmd, scm_fd) < 0)
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册