From: Daniel P. Berrange Date: Fri, 11 Sep 2009 15:26:40 +0000 (+0100) Subject: Save vcpuinfo in status file X-Git-Tag: v0.7.1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2ad7824aa16a089c7e25736d30978abb5ecf18c;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/domain_conf.c b/src/domain_conf.c index 050cf50aad..5ae0775836 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -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, " \n"); + for (i = 0 ; i < obj->nvcpupids ; i++) { + virBufferVSprintf(&buf, " \n", obj->vcpupids[i]); + } + virBufferAddLit(&buf, " \n"); + } + if (!(config_xml = virDomainDefFormat(conn, obj->def, flags))) diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 5a8a686ff4..60f815ef71 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -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;