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>
virCPUDefFormatBufFull(buf, priv->origCPU, NULL, false);
+ if (priv->chardevStdioLogd)
+ virBufferAddLit(buf, "<chardevStdioLogd/>");
+
return 0;
}
if (virCPUDefParseXML(ctxt, "./cpu", VIR_CPU_TYPE_GUEST, &priv->origCPU) < 0)
goto error;
+ priv->chardevStdioLogd = virXPathBoolean("boolean(./chardevStdioLogd)",
+ ctxt) == 1;
+
return 0;
error:
/* 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) \
size_t i;
char *nodeset = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virCapsPtr caps;
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
}
}
+ /* 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
cleanup:
VIR_FREE(nodeset);
virObjectUnref(caps);
+ virObjectUnref(cfg);
return ret;
}