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

Fix detection of JSON when restarting libvirtd

The XML XPath for detecting JSON in the running VM statefile was
wrong causing all VMs to get JSON mode enabled at libvirtd restart.

In addition if a VM was running a JSON enabled QEMU once, and then
altered to point to a non-JSON enabled QEMU later the 'monJSON'
flag would not get reset to 0.

* src/qemu/qemu_driver.c: Fix setting/detection of JSON mode
上级 cc3618d7
...@@ -221,8 +221,11 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) ...@@ -221,8 +221,11 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
priv->monConfig->type = VIR_DOMAIN_CHR_TYPE_PTY; priv->monConfig->type = VIR_DOMAIN_CHR_TYPE_PTY;
VIR_FREE(tmp); VIR_FREE(tmp);
if (virXPathBoolean(NULL, "int(./monitor[1]/@json)", ctxt)) if (virXPathBoolean(NULL, "count(./monitor[@json = '1']) > 0", ctxt)) {
priv->monJSON = 1; priv->monJSON = 1;
} else {
priv->monJSON = 0;
}
switch (priv->monConfig->type) { switch (priv->monConfig->type) {
case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_PTY:
...@@ -2440,7 +2443,9 @@ static int qemudStartVMDaemon(virConnectPtr conn, ...@@ -2440,7 +2443,9 @@ static int qemudStartVMDaemon(virConnectPtr conn,
#if HAVE_YAJL #if HAVE_YAJL
if (qemuCmdFlags & QEMUD_CMD_FLAG_MONITOR_JSON) if (qemuCmdFlags & QEMUD_CMD_FLAG_MONITOR_JSON)
priv->monJSON = 1; priv->monJSON = 1;
else
#endif #endif
priv->monJSON = 0;
if ((ret = virFileDeletePid(driver->stateDir, vm->def->name)) != 0) { if ((ret = virFileDeletePid(driver->stateDir, vm->def->name)) != 0) {
virReportSystemError(conn, ret, virReportSystemError(conn, ret,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册