mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-27 07:22:07 +03:00
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: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
1763a2e7e2
commit
f9758109a7
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user