Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks
so that we can later use 'qemuBuildChardevCommand' for vhost-user disks
instead of a custom formatter.
Since we don't pass the FD for the vhost-user connection to qemu all of
the setup can be skipped.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 7 ++++++-
src/qemu/qemu_process.c | 4 ++++
tests/qemuxml2argvtest.c | 4 ++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d7751f731d..475f2f536e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11494,6 +11494,12 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainDeviceDef
*dev,
void *opaque)
{
switch ((virDomainDeviceType) dev->type) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ if (virStorageSourceGetActualType(dev->data.disk->src) !=
VIR_STORAGE_TYPE_VHOST_USER)
+ return 0;
+
+ return cb(dev, dev->data.disk->src->vhostuser, opaque);
+
case VIR_DOMAIN_DEVICE_NET:
if (virDomainNetGetActualType(dev->data.net) !=
VIR_DOMAIN_NET_TYPE_VHOSTUSER)
return 0;
@@ -11524,7 +11530,6 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainDeviceDef *dev,
return cb(dev, dev->data.rng->source.chardev, opaque);
- case VIR_DOMAIN_DEVICE_DISK:
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d31ab103cf..ed0b80be0b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6886,6 +6886,10 @@ qemuProcessPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
/* this function is also called for the monitor backend which doesn't have
* a 'dev' */
if (dev) {
+ /* vhost-user disk doesn't use FD passing */
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK)
+ return 0;
+
if (dev->type == VIR_DOMAIN_DEVICE_NET) {
/* due to a historical bug in qemu we don't use FD passtrhough for
* vhost-sockets for network devices */
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fa451b6b54..ac4b532ef1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -385,6 +385,10 @@ testPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
qemuDomainChrSourcePrivate *charpriv = QEMU_DOMAIN_CHR_SOURCE_PRIVATE(chardev);
if (dev) {
+ /* vhost-user disk doesn't use FD passing */
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK)
+ return 0;
+
if (dev->type == VIR_DOMAIN_DEVICE_NET) {
/* due to a historical bug in qemu we don't use FD passtrhough for
* vhost-sockets for network devices */
--
2.31.1