提交 f9758109 编写于 作者: P Pavel Hrdina

qemu: introduce chardevStdioLogd to qemu private data

In QEMU driver we can use virtlogd as stdio handler for source backend
of char devices if current QEMU is new enough and it's enabled in
qemu.conf.  We should store this information while starting a guest
because the config option may change while the guest is running.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 1763a2e7
......@@ -1885,6 +1885,9 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf,
virCPUDefFormatBufFull(buf, priv->origCPU, NULL, false);
if (priv->chardevStdioLogd)
virBufferAddLit(buf, "<chardevStdioLogd/>");
return 0;
}
......@@ -2156,6 +2159,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
if (virCPUDefParseXML(ctxt, "./cpu", VIR_CPU_TYPE_GUEST, &priv->origCPU) < 0)
goto error;
priv->chardevStdioLogd = virXPathBoolean("boolean(./chardevStdioLogd)",
ctxt) == 1;
return 0;
error:
......
......@@ -297,6 +297,9 @@ struct _qemuDomainObjPrivate {
/* CPU def used to start the domain when it differs from the one actually
* provided by QEMU. */
virCPUDefPtr origCPU;
/* If true virtlogd is used as stdio handler for character devices. */
bool chardevStdioLogd;
};
# define QEMU_DOMAIN_PRIVATE(vm) \
......
......@@ -5435,6 +5435,7 @@ qemuProcessPrepareDomain(virConnectPtr conn,
size_t i;
char *nodeset = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virCapsPtr caps;
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
......@@ -5471,6 +5472,13 @@ qemuProcessPrepareDomain(virConnectPtr conn,
}
}
/* Whether we should use virtlogd as stdio handler for character
* devices source backend. */
if (cfg->stdioLogD &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHARDEV_FILE_APPEND)) {
priv->chardevStdioLogd = true;
}
/*
* Normally PCI addresses are assigned in the virDomainCreate
* or virDomainDefine methods. We might still need to assign
......@@ -5534,6 +5542,7 @@ qemuProcessPrepareDomain(virConnectPtr conn,
cleanup:
VIR_FREE(nodeset);
virObjectUnref(caps);
virObjectUnref(cfg);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册