Thanks Ani for giving your time to this patch.
On 13/01/22 3:11 pm, Ani Sinha wrote:
On Wed, 12 Jan 2022, Divya Garg wrote:
> VM XML accepts target.port but this does not get passed while building the qemu
> command line for this VM.
>
> Signed-off-by: Divya Garg <divya.garg(a)nutanix.com>
> ---
> src/qemu/qemu_command.c | 25 +++++++++++++++----
> tests/qemuxml2argvdata/bios.args | 2 +-
> .../qemuxml2argvdata/console-compat-auto.args | 2 +-
> .../console-compat-auto.x86_64-latest.args | 2 +-
> .../console-compat-chardev.args | 2 +-
> .../console-compat-chardev.x86_64-latest.args | 2 +-
> tests/qemuxml2argvdata/console-compat.args | 2 +-
> .../console-compat.x86_64-latest.args | 2 +-
> .../qemuxml2argvdata/console-virtio-many.args | 2 +-
> tests/qemuxml2argvdata/controller-order.args | 2 +-
> .../name-escape.x86_64-2.11.0.args | 4 +--
> .../name-escape.x86_64-latest.args | 4 +--
> .../q35-virt-manager-basic.args | 2 +-
> .../serial-dev-chardev-iobase.args | 2 +-
> ...rial-dev-chardev-iobase.x86_64-latest.args | 2 +-
> .../qemuxml2argvdata/serial-dev-chardev.args | 2 +-
> .../serial-dev-chardev.x86_64-latest.args | 2 +-
> .../qemuxml2argvdata/serial-file-chardev.args | 2 +-
> .../serial-file-chardev.x86_64-latest.args | 2 +-
> tests/qemuxml2argvdata/serial-file-log.args | 2 +-
> .../serial-file-log.x86_64-latest.args | 2 +-
> .../qemuxml2argvdata/serial-many-chardev.args | 4 +--
> .../serial-many-chardev.x86_64-latest.args | 4 +--
> .../qemuxml2argvdata/serial-pty-chardev.args | 2 +-
> .../serial-pty-chardev.x86_64-latest.args | 2 +-
> tests/qemuxml2argvdata/serial-spiceport.args | 2 +-
> .../serial-spiceport.x86_64-latest.args | 2 +-
> .../qemuxml2argvdata/serial-tcp-chardev.args | 2 +-
> .../serial-tcp-chardev.x86_64-latest.args | 2 +-
> .../serial-tcp-telnet-chardev.args | 2 +-
> ...rial-tcp-telnet-chardev.x86_64-latest.args | 2 +-
> .../serial-tcp-tlsx509-chardev-notls.args | 4 +--
> ...p-tlsx509-chardev-notls.x86_64-latest.args | 4 +--
> .../serial-tcp-tlsx509-chardev-verify.args | 4 +--
> ...-tlsx509-chardev-verify.x86_64-latest.args | 4 +--
> .../serial-tcp-tlsx509-chardev.args | 4 +--
> ...ial-tcp-tlsx509-chardev.x86_64-latest.args | 4 +--
> .../serial-tcp-tlsx509-secret-chardev.args | 4 +--
> ...-tlsx509-secret-chardev.x86_64-latest.args | 4 +--
> .../qemuxml2argvdata/serial-udp-chardev.args | 4 +--
> .../serial-udp-chardev.x86_64-latest.args | 4 +--
> .../qemuxml2argvdata/serial-unix-chardev.args | 4 +--
> .../serial-unix-chardev.x86_64-latest.args | 4 +--
> tests/qemuxml2argvdata/serial-vc-chardev.args | 2 +-
> .../serial-vc-chardev.x86_64-latest.args | 2 +-
> tests/qemuxml2argvdata/user-aliases.args | 4 +--
> .../virtio-9p-createmode.x86_64-latest.args | 2 +-
> .../virtio-9p-multidevs.x86_64-latest.args | 2 +-
> .../x86_64-pc-graphics.x86_64-latest.args | 2 +-
> .../x86_64-pc-headless.x86_64-latest.args | 2 +-
> .../x86_64-q35-graphics.x86_64-latest.args | 2 +-
> .../x86_64-q35-headless.x86_64-latest.args | 2 +-
> 52 files changed, 88 insertions(+), 73 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index d822533ccb..4130df0ed9 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -10718,6 +10718,8 @@ qemuBuildSerialChrDeviceProps(const virDomainDef *def,
> g_autoptr(virJSONValue) props = NULL;
> g_autofree char *chardev = g_strdup_printf("char%s",
serial->info.alias);
> virQEMUCapsFlags caps;
> + const char *typestr;
> + int ret;
type should match the return type of this function. ret should be defined
as virJSONValue. I preferred your previous style to this one.
@john.levon will you
like to give your thoughts here ?
Also please rebase this patch to the latest git HEAD and run "ninja test"
to make sure all tests passes. When I applied this patch to my tree,
qemuxml2argvtest failed. I think some more xmls needs fixing.
Thanks for taking the
pain and checking.
> switch ((virDomainChrSerialTargetModel) serial->targetModel) {
> case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
> @@ -10750,11 +10752,24 @@ qemuBuildSerialChrDeviceProps(const virDomainDef *def,
> return NULL;
> }
>
> - if (virJSONValueObjectAdd(&props,
> - "s:driver",
virDomainChrSerialTargetModelTypeToString(serial->targetModel),
> - "s:chardev", chardev,
> - "s:id", serial->info.alias,
> - NULL) < 0)
> + typestr = virDomainChrSerialTargetModelTypeToString(serial->targetModel);
> +
> + if (serial->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL) {
> + ret = virJSONValueObjectAdd(&props,
> + "s:driver", typestr,
> + "s:chardev", chardev,
> + "s:id", serial->info.alias,
> + "k:index", serial->target.port,
> + NULL);
> + } else {
> + ret = virJSONValueObjectAdd(&props,
> + "s:driver", typestr,
> + "s:chardev", chardev,
> + "s:id", serial->info.alias,
> + NULL);
> + }
> +
> + if (ret < 0)
> return NULL;
>
> if (qemuBuildDeviceAddressProps(props, def, &serial->info) < 0)
> diff --git a/tests/qemuxml2argvdata/bios.args b/tests/qemuxml2argvdata/bios.args
> index 0469b7419e..62ec87541d 100644
> --- a/tests/qemuxml2argvdata/bios.args
> +++ b/tests/qemuxml2argvdata/bios.args
> @@ -31,7 +31,7 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -device usb-tablet,id=input0,bus=usb.0,port=1 \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -msg timestamp=on
> diff --git a/tests/qemuxml2argvdata/console-compat-auto.args
b/tests/qemuxml2argvdata/console-compat-auto.args
> index a4fbf3a2f2..936f375100 100644
> --- a/tests/qemuxml2argvdata/console-compat-auto.args
> +++ b/tests/qemuxml2argvdata/console-compat-auto.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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/console-compat-auto.x86_64-latest.args
b/tests/qemuxml2argvdata/console-compat-auto.x86_64-latest.args
> index 688baaf2aa..5eafadd428 100644
> --- a/tests/qemuxml2argvdata/console-compat-auto.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/console-compat-auto.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/console-compat-chardev.args
b/tests/qemuxml2argvdata/console-compat-chardev.args
> index a4fbf3a2f2..936f375100 100644
> --- a/tests/qemuxml2argvdata/console-compat-chardev.args
> +++ b/tests/qemuxml2argvdata/console-compat-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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/console-compat-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/console-compat-chardev.x86_64-latest.args
> index 688baaf2aa..5eafadd428 100644
> --- a/tests/qemuxml2argvdata/console-compat-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/console-compat-chardev.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/console-compat.args
b/tests/qemuxml2argvdata/console-compat.args
> index afaf50d4ba..e91e3c349f 100644
> --- a/tests/qemuxml2argvdata/console-compat.args
> +++ b/tests/qemuxml2argvdata/console-compat.args
> @@ -30,5 +30,5 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -msg timestamp=on
> diff --git a/tests/qemuxml2argvdata/console-compat.x86_64-latest.args
b/tests/qemuxml2argvdata/console-compat.x86_64-latest.args
> index cd81c2cec9..66cb02b1c6 100644
> --- a/tests/qemuxml2argvdata/console-compat.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/console-compat.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> -msg timestamp=on
> diff --git a/tests/qemuxml2argvdata/console-virtio-many.args
b/tests/qemuxml2argvdata/console-virtio-many.args
> index dc1aca1129..b509cd55b5 100644
> --- a/tests/qemuxml2argvdata/console-virtio-many.args
> +++ b/tests/qemuxml2argvdata/console-virtio-many.args
> @@ -31,7 +31,7 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev pty,id=charconsole1 \
> -device virtconsole,chardev=charconsole1,id=console1 \
> -chardev pty,id=charconsole2 \
> diff --git a/tests/qemuxml2argvdata/controller-order.args
b/tests/qemuxml2argvdata/controller-order.args
> index 51571a27bf..51fa04dfd8 100644
> --- a/tests/qemuxml2argvdata/controller-order.args
> +++ b/tests/qemuxml2argvdata/controller-order.args
> @@ -37,7 +37,7 @@ QEMU_AUDIO_DRV=spice \
> -chardev spicevmc,id=charsmartcard0,name=smartcard \
> -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev spicevmc,id=charchannel0,name=vdagent \
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
\
> -device usb-tablet,id=input0,bus=usb.0,port=1.2 \
> 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 241449f75d..a246c08b12 100644
> --- a/tests/qemuxml2argvdata/name-escape.x86_64-2.11.0.args
> +++ b/tests/qemuxml2argvdata/name-escape.x86_64-2.11.0.args
> @@ -32,9 +32,9 @@ QEMU_AUDIO_DRV=spice \
> -device
ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1,write-cache=on \
> -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 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=1 \
> -chardev file,id=charserial1,path=/tmp/serial.log,,foo,append=on \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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 \
> -vnc vnc=unix:/tmp/lib/domain--1-foo=1,,bar=2/vnc.sock \
> diff --git a/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
b/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
> index bdd0254499..19939030ad 100644
> --- a/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/name-escape.x86_64-latest.args
> @@ -34,10 +34,10 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-foo=1,bar=2/.config \
> -device
ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \
> -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 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=1 \
> -add-fd set=0,fd=1750 \
> -chardev file,id=charserial1,path=/dev/fdset/0,append=on \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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 \
> -audiodev
'{"id":"audio1","driver":"spice"}' \
> diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.args
b/tests/qemuxml2argvdata/q35-virt-manager-basic.args
> index 49e0f6794e..afaff44212 100644
> --- a/tests/qemuxml2argvdata/q35-virt-manager-basic.args
> +++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.args
> @@ -40,7 +40,7 @@ QEMU_AUDIO_DRV=spice \
> -netdev user,id=hostnet0 \
> -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:9a:e6:c6,bus=pci.1,addr=0x0 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev
socket,id=charchannel0,path=/tmp/channel/domain--1-virt-manager-basic/org.qemu.guest_agent.0,server=on,wait=off
\
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
\
> -chardev spicevmc,id=charchannel1,name=vdagent \
> diff --git a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
> index bcca630616..bcaf66f88d 100644
> --- a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
> +++ b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 tty,id=charserial0,path=/dev/ttyS2 \
> --device isa-serial,chardev=charserial0,id=serial0,iobase=1016,irq=4 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0,iobase=1016,irq=4 \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -msg timestamp=on
> 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 94d76fac91..067fa6987f 100644
> --- a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 \
> --device isa-serial,chardev=charserial0,id=serial0,iobase=1016,irq=4 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-dev-chardev.args
b/tests/qemuxml2argvdata/serial-dev-chardev.args
> index fb5276bc5f..0bf5d6ceb0 100644
> --- a/tests/qemuxml2argvdata/serial-dev-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-dev-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 tty,id=charserial0,path=/dev/ttyS2 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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-dev-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args
> index fe46edb5f6..a76bf66f8f 100644
> --- a/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-dev-chardev.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-file-chardev.args
b/tests/qemuxml2argvdata/serial-file-chardev.args
> index db46920bab..4ec07d9b1f 100644
> --- a/tests/qemuxml2argvdata/serial-file-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-file-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-file-chardev.x86_64-latest.args
> index 02a5bbc121..308e73c0b9 100644
> --- a/tests/qemuxml2argvdata/serial-file-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-file-chardev.x86_64-latest.args
> @@ -33,7 +33,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
> -add-fd set=0,fd=1750 \
> -chardev file,id=charserial0,path=/dev/fdset/0,append=on \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-file-log.args
b/tests/qemuxml2argvdata/serial-file-log.args
> index 3833413150..1ffa30d207 100644
> --- a/tests/qemuxml2argvdata/serial-file-log.args
> +++ b/tests/qemuxml2argvdata/serial-file-log.args
> @@ -30,5 +30,5 @@ QEMU_AUDIO_DRV=none \
> -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
\
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -msg timestamp=on
> diff --git a/tests/qemuxml2argvdata/serial-file-log.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-file-log.x86_64-latest.args
> index 39c93eaa0c..558e189e86 100644
> --- a/tests/qemuxml2argvdata/serial-file-log.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-file-log.x86_64-latest.args
> @@ -34,7 +34,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> -msg timestamp=on
> diff --git a/tests/qemuxml2argvdata/serial-many-chardev.args
b/tests/qemuxml2argvdata/serial-many-chardev.args
> index 11e187fead..e0005656ea 100644
> --- a/tests/qemuxml2argvdata/serial-many-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-many-chardev.args
> @@ -30,8 +30,8 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev file,id=charserial1,path=/tmp/serial.log \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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/qemuxml2argvdata/serial-many-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-many-chardev.x86_64-latest.args
> index c15fbeafb9..29be886c5d 100644
> --- a/tests/qemuxml2argvdata/serial-many-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-many-chardev.x86_64-latest.args
> @@ -32,10 +32,10 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -add-fd set=0,fd=1750 \
> -chardev file,id=charserial1,path=/dev/fdset/0,append=on \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-pty-chardev.args
b/tests/qemuxml2argvdata/serial-pty-chardev.args
> index a4fbf3a2f2..936f375100 100644
> --- a/tests/qemuxml2argvdata/serial-pty-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-pty-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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-pty-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-pty-chardev.x86_64-latest.args
> index 688baaf2aa..5eafadd428 100644
> --- a/tests/qemuxml2argvdata/serial-pty-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-pty-chardev.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-spiceport.args
b/tests/qemuxml2argvdata/serial-spiceport.args
> index 9e0c483f3d..7d4c2a0d37 100644
> --- a/tests/qemuxml2argvdata/serial-spiceport.args
> +++ b/tests/qemuxml2argvdata/serial-spiceport.args
> @@ -29,7 +29,7 @@ QEMU_AUDIO_DRV=spice \
> -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 spiceport,id=charserial0,name=org.qemu.console.serial.0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -device usb-tablet,id=input0,bus=usb.0,port=1 \
> -spice
port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on
\
> -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2
\
> diff --git a/tests/qemuxml2argvdata/serial-spiceport.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-spiceport.x86_64-latest.args
> index 5ac813d814..5315f66849 100644
> --- a/tests/qemuxml2argvdata/serial-spiceport.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-spiceport.x86_64-latest.args
> @@ -31,7 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 spiceport,id=charserial0,name=org.qemu.console.serial.0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -device usb-tablet,id=input0,bus=usb.0,port=1 \
> -audiodev
'{"id":"audio1","driver":"spice"}' \
> -spice
port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on
\
> diff --git a/tests/qemuxml2argvdata/serial-tcp-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-chardev.args
> index 63b16ded13..de5af9c7ed 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 socket,id=charserial0,host=127.0.0.1,port=9999 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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-tcp-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-tcp-chardev.x86_64-latest.args
> index f15a843909..bd98ea6be4 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-chardev.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 socket,id=charserial0,host=127.0.0.1,port=9999 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
> index a804bdf7e6..2ac30c694c 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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
socket,id=charserial0,host=127.0.0.1,port=9999,telnet=on,server=on,wait=off \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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-tcp-telnet-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.x86_64-latest.args
> index da4f1e8aae..67cedc30e9 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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
socket,id=charserial0,host=127.0.0.1,port=9999,telnet=on,server=on,wait=off \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
> index a49f649309..302dc59394 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
> @@ -30,8 +30,8 @@ QEMU_AUDIO_DRV=none \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charserial1,host=127.0.0.1,port=5555 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
> -msg timestamp=on
> diff --git
a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.x86_64-latest.args
> index 45b1386916..58ae1338fa 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.x86_64-latest.args
> @@ -32,9 +32,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charserial1,host=127.0.0.1,port=5555 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
> index 8e45fc5490..998413bf0f 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
> @@ -30,9 +30,9 @@ QEMU_AUDIO_DRV=none \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -object
tls-creds-x509,id=objcharserial1_tls0,dir=/etc/pki/libvirt-chardev,endpoint=client,verify-peer=on
\
> -chardev
socket,id=charserial1,host=127.0.0.1,port=5555,tls-creds=objcharserial1_tls0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.x86_64-latest.args
> index 7b9b49b1cb..7f72c2d045 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.x86_64-latest.args
> @@ -32,10 +32,10 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -object
'{"qom-type":"tls-creds-x509","id":"objcharserial1_tls0","dir":"/etc/pki/libvirt-chardev","endpoint":"client","verify-peer":true}'
\
> -chardev
socket,id=charserial1,host=127.0.0.1,port=5555,tls-creds=objcharserial1_tls0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
> index 8e45fc5490..998413bf0f 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
> @@ -30,9 +30,9 @@ QEMU_AUDIO_DRV=none \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -object
tls-creds-x509,id=objcharserial1_tls0,dir=/etc/pki/libvirt-chardev,endpoint=client,verify-peer=on
\
> -chardev
socket,id=charserial1,host=127.0.0.1,port=5555,tls-creds=objcharserial1_tls0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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/qemuxml2argvdata/serial-tcp-tlsx509-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.x86_64-latest.args
> index 7b9b49b1cb..7f72c2d045 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.x86_64-latest.args
> @@ -32,10 +32,10 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -object
'{"qom-type":"tls-creds-x509","id":"objcharserial1_tls0","dir":"/etc/pki/libvirt-chardev","endpoint":"client","verify-peer":true}'
\
> -chardev
socket,id=charserial1,host=127.0.0.1,port=5555,tls-creds=objcharserial1_tls0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
> index 23331ed1d4..17926d7a11 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
> @@ -30,10 +30,10 @@ QEMU_AUDIO_DRV=none \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -object
secret,id=charserial1-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64
\
> -object
tls-creds-x509,id=objcharserial1_tls0,dir=/etc/pki/libvirt-chardev,endpoint=client,verify-peer=on,passwordid=charserial1-secret0
\
> -chardev
socket,id=charserial1,host=127.0.0.1,port=5555,tls-creds=objcharserial1_tls0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
> -msg timestamp=on
> diff --git
a/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.x86_64-latest.args
> index 1ce871f3cf..7ff4f6c5b2 100644
> --- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.x86_64-latest.args
> @@ -32,11 +32,11 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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
udp,id=charserial0,host=127.0.0.1,port=2222,localaddr=127.0.0.1,localport=1111 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -object
'{"qom-type":"secret","id":"charserial1-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}'
\
> -object
'{"qom-type":"tls-creds-x509","id":"objcharserial1_tls0","dir":"/etc/pki/libvirt-chardev","endpoint":"client","verify-peer":true,"passwordid":"charserial1-secret0"}'
\
> -chardev
socket,id=charserial1,host=127.0.0.1,port=5555,tls-creds=objcharserial1_tls0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-udp-chardev.args
b/tests/qemuxml2argvdata/serial-udp-chardev.args
> index 9e5e909881..93bf2f4f0d 100644
> --- a/tests/qemuxml2argvdata/serial-udp-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-udp-chardev.args
> @@ -30,8 +30,8 @@ QEMU_AUDIO_DRV=none \
> -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
udp,id=charserial0,host=127.0.0.1,port=9998,localaddr=127.0.0.1,localport=9999 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev udp,id=charserial1,host=,port=9999,localaddr=,localport=0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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/qemuxml2argvdata/serial-udp-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-udp-chardev.x86_64-latest.args
> index 48b44f8ffd..2c8b2bd117 100644
> --- a/tests/qemuxml2argvdata/serial-udp-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-udp-chardev.x86_64-latest.args
> @@ -32,9 +32,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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
udp,id=charserial0,host=127.0.0.1,port=9998,localaddr=127.0.0.1,localport=9999 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev udp,id=charserial1,host=,port=9999,localaddr=,localport=0 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-unix-chardev.args
b/tests/qemuxml2argvdata/serial-unix-chardev.args
> index 6f533a991a..4192ef5621 100644
> --- a/tests/qemuxml2argvdata/serial-unix-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-unix-chardev.args
> @@ -28,8 +28,8 @@ QEMU_AUDIO_DRV=none \
> -boot strict=on \
> -usb \
> -chardev socket,id=charserial0,path=/tmp/serial.sock \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charserial1,path=/tmp/serial-server.sock,server=on,wait=off \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-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/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
> index b8adaa39bc..27388d1351 100644
> --- a/tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-unix-chardev.x86_64-latest.args
> @@ -29,9 +29,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -boot strict=on \
> -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
> -chardev socket,id=charserial0,path=/tmp/serial.sock \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charserial1,fd=1729,server=on,wait=off \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/serial-vc-chardev.args
b/tests/qemuxml2argvdata/serial-vc-chardev.args
> index 65b1473c70..6870f976e4 100644
> --- a/tests/qemuxml2argvdata/serial-vc-chardev.args
> +++ b/tests/qemuxml2argvdata/serial-vc-chardev.args
> @@ -30,6 +30,6 @@ QEMU_AUDIO_DRV=none \
> -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 vc,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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-vc-chardev.x86_64-latest.args
b/tests/qemuxml2argvdata/serial-vc-chardev.x86_64-latest.args
> index 5c59309ad5..81f51dc8d7 100644
> --- a/tests/qemuxml2argvdata/serial-vc-chardev.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/serial-vc-chardev.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -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 vc,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-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 \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/user-aliases.args
b/tests/qemuxml2argvdata/user-aliases.args
> index 248469a668..bcd901da90 100644
> --- a/tests/qemuxml2argvdata/user-aliases.args
> +++ b/tests/qemuxml2argvdata/user-aliases.args
> @@ -55,9 +55,9 @@ QEMU_AUDIO_DRV=none \
> -device
rtl8139,netdev=hostua-AndAlsoClientMode,id=ua-AndAlsoClientMode,mac=52:54:00:8c:b1:f8,bus=pci.0,addr=0xa
\
> -device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ua-myCCID.0 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev pty,id=charserial1 \
> --device isa-serial,chardev=charserial1,id=serial1 \
> +-device isa-serial,chardev=charserial1,id=serial1,index=1 \
> -chardev
socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/gentoo.org.qemu.guest_agent.0,server=on,wait=off
\
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
\
> -vnc 127.0.0.1:0 \
> diff --git a/tests/qemuxml2argvdata/virtio-9p-createmode.x86_64-latest.args
b/tests/qemuxml2argvdata/virtio-9p-createmode.x86_64-latest.args
> index 697bb1e655..92e4c770e2 100644
> --- a/tests/qemuxml2argvdata/virtio-9p-createmode.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/virtio-9p-createmode.x86_64-latest.args
> @@ -37,7 +37,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -fsdev local,security_model=mapped,id=fsdev-fs3,path=/export/fs3 \
> -device virtio-9p-pci,id=fs3,fsdev=fsdev-fs3,mount_tag=fs3,bus=pci.0,addr=0x5 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/virtio-9p-multidevs.x86_64-latest.args
b/tests/qemuxml2argvdata/virtio-9p-multidevs.x86_64-latest.args
> index e52826f2c4..cd8948de04 100644
> --- a/tests/qemuxml2argvdata/virtio-9p-multidevs.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/virtio-9p-multidevs.x86_64-latest.args
> @@ -35,7 +35,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> -fsdev local,security_model=mapped,multidevs=warn,id=fsdev-fs2,path=/export/fs2 \
> -device virtio-9p-pci,id=fs2,fsdev=fsdev-fs2,mount_tag=fs2,bus=pci.0,addr=0x4 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -audiodev
'{"id":"audio1","driver":"none"}' \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc \
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> diff --git a/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args
b/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args
> index 313d1e684f..4b76dd1665 100644
> --- a/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args
> @@ -37,7 +37,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
> -netdev user,id=hostnet0 \
> -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:4c:e3:86,bus=pci.0,addr=0x3 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
\
> -device usb-tablet,id=input0,bus=usb.0,port=1 \
> diff --git a/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args
b/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args
> index 0ce0be2bc8..64559a1150 100644
> --- a/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args
> @@ -38,7 +38,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
> -netdev user,id=hostnet0 \
> -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37,bus=pci.0,addr=0x2 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
\
> -audiodev
'{"id":"audio1","driver":"none"}' \
> diff --git a/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args
b/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args
> index deab063476..f8f12ada5c 100644
> --- a/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args
> @@ -44,7 +44,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
> -netdev user,id=hostnet0 \
> -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:d2:70:0b,bus=pci.1,addr=0x0 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
\
> -device usb-tablet,id=input0,bus=usb.0,port=1 \
> diff --git a/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args
b/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args
> index f35385702a..7db2d691d6 100644
> --- a/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args
> @@ -45,7 +45,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
> -netdev user,id=hostnet0 \
> -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37,bus=pci.1,addr=0x0 \
> -chardev pty,id=charserial0 \
> --device isa-serial,chardev=charserial0,id=serial0 \
> +-device isa-serial,chardev=charserial0,id=serial0,index=0 \
> -chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
> -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
\
> -audiodev
'{"id":"audio1","driver":"none"}' \
> --
> 2.25.1
>
>