When hotplugging a chardev we need the same form of setup for the
character device. Export a version which takes a 'virDomainDeviceDef'.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_process.c | 27 +++++++++++++++++++++++++++
src/qemu/qemu_process.h | 6 ++++++
2 files changed, 33 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b44e684589..9fea72960f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6965,6 +6965,33 @@ qemuProcessPrepareHostBackendChardev(virDomainObj *vm)
}
+int
+qemuProcessPrepareHostBackendChardevHotplug(virDomainObj *vm,
+ virDomainDeviceDef *dev)
+{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
+ struct qemuProcessPrepareHostBackendChardevData data = {
+ .priv = priv,
+ .logManager = NULL,
+ .cfg = cfg,
+ .def = vm->def,
+ };
+ g_autoptr(virLogManager) logManager = NULL;
+
+ if (cfg->stdioLogD) {
+ if (!(logManager = data.logManager =
virLogManagerNew(priv->driver->privileged)))
+ return -1;
+ }
+
+ if (qemuDomainDeviceBackendChardevForeachOne(dev,
+
qemuProcessPrepareHostBackendChardevOne,
+ &data) < 0)
+ return -1;
+
+ return 0;
+}
+
/**
* qemuProcessPrepareHost:
* @driver: qemu driver
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index f6dd3f5104..289cd74eb7 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -120,6 +120,12 @@ int qemuProcessOpenVhostVsock(virDomainVsockDef *vsock);
int qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev);
+
+int qemuProcessPrepareHostBackendChardevHotplug(virDomainObj *vm,
+ virDomainDeviceDef *dev)
+ G_GNUC_NO_INLINE;
+
+
int qemuProcessPrepareHost(virQEMUDriver *driver,
virDomainObj *vm,
unsigned int flags);
--
2.34.1