[PATCH] qemu: command: Don't use deprecated chardev backend drivers 'tty' and 'parport'

Peter Krempa pkrempa at redhat.com
Mon Aug 29 15:03:31 UTC 2022


The replacement is 'serial' and 'parallel' respectively introduced at
least in qemu-2.9 and the old versions are deprecated since qemu-6.0.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_command.c                              | 12 ++++++++----
 .../qemuxml2argvdata/name-escape.x86_64-latest.args  |  2 +-
 tests/qemuxml2argvdata/parallel-parport-chardev.args |  2 +-
 .../parallel-parport-chardev.x86_64-latest.args      |  2 +-
 tests/qemuxml2argvdata/pci-serial-dev-chardev.args   |  2 +-
 .../pci-serial-dev-chardev.x86_64-latest.args        |  2 +-
 .../qemuxml2argvdata/serial-dev-chardev-iobase.args  |  2 +-
 .../serial-dev-chardev-iobase.x86_64-latest.args     |  2 +-
 tests/qemuxml2argvdata/serial-dev-chardev.args       |  2 +-
 .../serial-dev-chardev.x86_64-latest.args            |  2 +-
 10 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a31b8ee438..da04537234 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1314,12 +1314,16 @@ qemuBuildChardevStr(const virDomainChrSourceDef *dev,
         virBufferAsprintf(&buf, "pty,id=%s", charAlias);
         break;

-    case VIR_DOMAIN_CHR_TYPE_DEV:
-        virBufferAsprintf(&buf, "%s,id=%s,path=",
-                          STRPREFIX(charAlias, "charparallel") ? "parport" : "tty",
-                          charAlias);
+    case VIR_DOMAIN_CHR_TYPE_DEV: {
+        const char *backend = "serial";
+
+        if (STRPREFIX(charAlias, "charparallel"))
+            backend = "parallel";
+
+        virBufferAsprintf(&buf, "%s,id=%s,path=", backend, charAlias);
         virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path);
         break;
+    }

     case VIR_DOMAIN_CHR_TYPE_FILE:
         virBufferAsprintf(&buf, "file,id=%s", charAlias);
diff --git a/tests/qemuxml2argvdata/name-escape.x86_64-latest.args b/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
index b8ac17eee6..42b0ad3230 100644
--- a/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
@@ -33,7 +33,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-foo=1,bar=2/.config \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \
 -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \
 -device '{"driver":"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 \
+-chardev serial,id=charserial0,path=/dev/ttyS2,,foo \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":1}' \
 -add-fd set=0,fd=1750,opaque=serial1-source \
 -chardev file,id=charserial1,path=/dev/fdset/0,append=on \
diff --git a/tests/qemuxml2argvdata/parallel-parport-chardev.args b/tests/qemuxml2argvdata/parallel-parport-chardev.args
index e3d3d6f3db..66b398fe64 100644
--- a/tests/qemuxml2argvdata/parallel-parport-chardev.args
+++ b/tests/qemuxml2argvdata/parallel-parport-chardev.args
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
--chardev parport,id=charparallel0,path=/dev/parport0 \
+-chardev parallel,id=charparallel0,path=/dev/parport0 \
 -device isa-parallel,chardev=charparallel0,id=parallel0 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
diff --git a/tests/qemuxml2argvdata/parallel-parport-chardev.x86_64-latest.args b/tests/qemuxml2argvdata/parallel-parport-chardev.x86_64-latest.args
index 2ce2e381bb..6200251f1e 100644
--- a/tests/qemuxml2argvdata/parallel-parport-chardev.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/parallel-parport-chardev.x86_64-latest.args
@@ -31,7 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
--chardev parport,id=charparallel0,path=/dev/parport0 \
+-chardev parallel,id=charparallel0,path=/dev/parport0 \
 -device '{"driver":"isa-parallel","chardev":"charparallel0","id":"parallel0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
diff --git a/tests/qemuxml2argvdata/pci-serial-dev-chardev.args b/tests/qemuxml2argvdata/pci-serial-dev-chardev.args
index 651b2732f5..0cc0ef2c14 100644
--- a/tests/qemuxml2argvdata/pci-serial-dev-chardev.args
+++ b/tests/qemuxml2argvdata/pci-serial-dev-chardev.args
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
--chardev tty,id=charserial0,path=/dev/ttyS2 \
+-chardev serial,id=charserial0,path=/dev/ttyS2 \
 -device pci-serial,chardev=charserial0,id=serial0,bus=pci.0,addr=0x4 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
diff --git a/tests/qemuxml2argvdata/pci-serial-dev-chardev.x86_64-latest.args b/tests/qemuxml2argvdata/pci-serial-dev-chardev.x86_64-latest.args
index c513ae0316..94d90b215c 100644
--- a/tests/qemuxml2argvdata/pci-serial-dev-chardev.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/pci-serial-dev-chardev.x86_64-latest.args
@@ -31,7 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
--chardev tty,id=charserial0,path=/dev/ttyS2 \
+-chardev serial,id=charserial0,path=/dev/ttyS2 \
 -device '{"driver":"pci-serial","chardev":"charserial0","id":"serial0","bus":"pci.0","addr":"0x4"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
index 735dcd053a..32218842ef 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
--chardev tty,id=charserial0,path=/dev/ttyS2 \
+-chardev serial,id=charserial0,path=/dev/ttyS2 \
 -device isa-serial,chardev=charserial0,id=serial0,index=0,iobase=1016,irq=4 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.x86_64-latest.args b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.x86_64-latest.args
index a22237b680..3b5ce0a59b 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.x86_64-latest.args
@@ -31,7 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
--chardev tty,id=charserial0,path=/dev/ttyS2 \
+-chardev serial,id=charserial0,path=/dev/ttyS2 \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0,"iobase":1016,"irq":4}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev.args b/tests/qemuxml2argvdata/serial-dev-chardev.args
index 52f9c3d0bb..ba8832f64f 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev.args
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
--chardev tty,id=charserial0,path=/dev/ttyS2 \
+-chardev serial,id=charserial0,path=/dev/ttyS2 \
 -device isa-serial,chardev=charserial0,id=serial0,index=0 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args b/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args
index a19d3bb209..ffa9bac136 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args
@@ -31,7 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
 -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
--chardev tty,id=charserial0,path=/dev/ttyS2 \
+-chardev serial,id=charserial0,path=/dev/ttyS2 \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
-- 
2.37.1



More information about the libvir-list mailing list