Code paths which don't wish to use FD passing are supposed to not call
the function which sets up the chardev for FD passing.
This is ensured by calling it only in the host prepare step.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_process.c | 11 -----------
tests/qemuxml2argvdata/aarch64-pci-serial.args | 3 ++-
.../name-escape.x86_64-2.11.0.args | 3 ++-
tests/qemuxml2argvdata/serial-file-chardev.args | 3 ++-
tests/qemuxml2argvdata/serial-file-log.args | 4 +++-
tests/qemuxml2argvdata/serial-many-chardev.args | 3 ++-
tests/qemuxml2argvtest.c | 16 ++++++----------
7 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 24873f6fb7..169d9d1755 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6758,18 +6758,9 @@ qemuProcessPrepareHostBackendChardevFileHelper(const char *path,
int *fd,
virLogManager *logManager,
virSecurityManager *secManager,
- virQEMUCaps *qemuCaps,
virQEMUDriverConfig *cfg,
const virDomainDef *def)
{
- /* Technically, to pass an FD via /dev/fdset we don't need
- * any capability check because X_QEMU_CAPS_ADD_FD is already
- * assumed. But keeping the old style is still handy when
- * building a standalone command line (e.g. for tests). */
- if (!logManager &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE))
- return 0;
-
if (logManager) {
int flags = 0;
@@ -6867,7 +6858,6 @@ qemuProcessPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
&charpriv->fd,
data->logManager,
data->secManager,
- data->qemuCaps,
data->cfg,
data->def) < 0)
return -1;
@@ -6908,7 +6898,6 @@ qemuProcessPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
&charpriv->logfd,
data->logManager,
data->secManager,
- data->qemuCaps,
data->cfg,
data->def) < 0)
return -1;
diff --git a/tests/qemuxml2argvdata/aarch64-pci-serial.args
b/tests/qemuxml2argvdata/aarch64-pci-serial.args
index b4f84cf778..aca88e8e60 100644
--- a/tests/qemuxml2argvdata/aarch64-pci-serial.args
+++ b/tests/qemuxml2argvdata/aarch64-pci-serial.args
@@ -29,6 +29,7 @@ QEMU_AUDIO_DRV=none \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=16,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
--chardev pty,id=charserial0,logfile=/tmp/log,logappend=on \
+-add-fd set=0,fd=1751 \
+-chardev pty,id=charserial0,logfile=/dev/fdset/0,logappend=on \
-device pci-serial,chardev=charserial0,id=serial0,bus=pci.2,addr=0x1 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/name-escape.x86_64-2.11.0.args
b/tests/qemuxml2argvdata/name-escape.x86_64-2.11.0.args
index a246c08b12..6d4c5bff6e 100644
--- a/tests/qemuxml2argvdata/name-escape.x86_64-2.11.0.args
+++ b/tests/qemuxml2argvdata/name-escape.x86_64-2.11.0.args
@@ -33,7 +33,8 @@ QEMU_AUDIO_DRV=spice \
-device
ccid-card-emulated,backend=certificates,cert1=cert1,,foo,cert2=cert2,cert3=cert3,db=/etc/pki/nssdb,,foo,id=smartcard0,bus=ccid0.0
\
-chardev tty,id=charserial0,path=/dev/ttyS2,,foo \
-device isa-serial,chardev=charserial0,id=serial0,index=1 \
--chardev file,id=charserial1,path=/tmp/serial.log,,foo,append=on \
+-add-fd set=0,fd=1750 \
+-chardev file,id=charserial1,path=/dev/fdset/0,append=on \
-device isa-serial,chardev=charserial1,id=serial1,index=0 \
-chardev pipe,id=charchannel0,path=/tmp/guestfwd,,foo \
-netdev user,guestfwd=tcp:10.0.2.1:4600-chardev:charchannel0,id=channel0 \
diff --git a/tests/qemuxml2argvdata/serial-file-chardev.args
b/tests/qemuxml2argvdata/serial-file-chardev.args
index 4ec07d9b1f..7df5c2a115 100644
--- a/tests/qemuxml2argvdata/serial-file-chardev.args
+++ b/tests/qemuxml2argvdata/serial-file-chardev.args
@@ -29,7 +29,8 @@ QEMU_AUDIO_DRV=none \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--chardev file,id=charserial0,path=/tmp/serial.log,append=on \
+-add-fd set=0,fd=1750 \
+-chardev file,id=charserial0,path=/dev/fdset/0,append=on \
-device isa-serial,chardev=charserial0,id=serial0,index=0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/serial-file-log.args
b/tests/qemuxml2argvdata/serial-file-log.args
index 1ffa30d207..72d7c49298 100644
--- a/tests/qemuxml2argvdata/serial-file-log.args
+++ b/tests/qemuxml2argvdata/serial-file-log.args
@@ -29,6 +29,8 @@ QEMU_AUDIO_DRV=none \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--chardev
file,id=charserial0,path=/tmp/serial.log,logfile=/var/lib/libvirt/qemu/demo-serial.log,logappend=off
\
+-add-fd set=0,fd=1750 \
+-add-fd set=1,fd=1751 \
+-chardev
file,id=charserial0,path=/dev/fdset/0,append=on,logfile=/dev/fdset/1,logappend=on \
-device isa-serial,chardev=charserial0,id=serial0,index=0 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/serial-many-chardev.args
b/tests/qemuxml2argvdata/serial-many-chardev.args
index e0005656ea..5e80348d11 100644
--- a/tests/qemuxml2argvdata/serial-many-chardev.args
+++ b/tests/qemuxml2argvdata/serial-many-chardev.args
@@ -31,7 +31,8 @@ QEMU_AUDIO_DRV=none \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
-chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0,index=0 \
--chardev file,id=charserial1,path=/tmp/serial.log \
+-add-fd set=0,fd=1750 \
+-chardev file,id=charserial1,path=/dev/fdset/0,append=on \
-device isa-serial,chardev=charserial1,id=serial1,index=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6cf35a0ebf..b2d6606d6e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -416,11 +416,9 @@ testPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
break;
case VIR_DOMAIN_CHR_TYPE_FILE:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE)) {
- if (fcntl(1750, F_GETFD) != -1)
- abort();
- charpriv->fd = 1750;
- }
+ if (fcntl(1750, F_GETFD) != -1)
+ abort();
+ charpriv->fd = 1750;
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
@@ -440,11 +438,9 @@ testPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
}
if (chardev->logfile) {
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE)) {
- if (fcntl(1751, F_GETFD) != -1)
- abort();
- charpriv->logfd = 1751;
- }
+ if (fcntl(1751, F_GETFD) != -1)
+ abort();
+ charpriv->logfd = 1751;
}
return 0;
--
2.34.1