On 04/11/2018 07:22 AM, Thilo Cestonaro wrote:
Not entirely my area of expertise, console serial ports, but I'll
provide some feedback. Maybe someone else will chime in too...
A configured target.port is currently totaly ignored, while
constructing
s/totaly/totally
s/,//
qemu commandline, for all types of serial devices. This patch adds a
-device
s/,//
parameter "index" for the target model isa-serial.
Please add blank lines between paragraphs - tough to read... Needed for
each of the 4 paragraphs...
This enables the user to specify which serial device will end in
which ttySX
device.
But shouldn't they then specify that's what they want to happen rather
than appending for every one? Perhaps I'm missing something subtle.
Still you have a very specific usage model, the ttySX console, but
you're trying to model a generic solution. Is there really a need to
supply the index when there's only 1 serial console device/port?
Updated test results which failed because of this change.
They failed perhaps because you took this too far?
Added two tests serial-dev-without-target-port,
serial-dev-with-target-port
which test generating qemu command with multiple serial devices and different
ports.
Ahhh and this is what I'll key off mostly...
Signed-off-by: Thilo Cestonaro <thilo.cestonaro(a)ts.fujitsu.com>
---
v2: added tests which create qemu commandline with and without specified target
ports. Updated existing tests to pass again.
Noting v2 here is nice, but the subject line should have PATCHv2...
src/qemu/qemu_command.c | 16 ++++++++
tests/qemuxml2argvdata/bios.args | 2 +-
.../qemuxml2argvdata/console-compat-auto.args | 2 +-
.../console-compat-chardev.args | 2 +-
tests/qemuxml2argvdata/console-compat.args | 2 +-
.../qemuxml2argvdata/console-virtio-many.args | 2 +-
tests/qemuxml2argvdata/controller-order.args | 2 +-
.../q35-virt-manager-basic.args | 2 +-
.../serial-dev-chardev-iobase.args | 2 +-
.../qemuxml2argvdata/serial-dev-chardev.args | 2 +-
tests/qemuxml2argvdata/serial-dev-chardev.xml | 4 +-
.../serial-dev-with-target-port.args | 31 +++++++++++++++
.../serial-dev-with-target-port.xml | 38 +++++++++++++++++++
.../serial-dev-without-target-port.args | 31 +++++++++++++++
.../serial-dev-without-target-port.xml | 35 +++++++++++++++++
.../qemuxml2argvdata/serial-file-chardev.args | 2 +-
tests/qemuxml2argvdata/serial-file-log.args | 2 +-
.../qemuxml2argvdata/serial-many-chardev.args | 4 +-
.../qemuxml2argvdata/serial-pty-chardev.args | 2 +-
tests/qemuxml2argvdata/serial-spiceport.args | 2 +-
.../qemuxml2argvdata/serial-tcp-chardev.args | 2 +-
.../serial-tcp-telnet-chardev.args | 2 +-
.../serial-tcp-tlsx509-chardev-notls.args | 4 +-
.../serial-tcp-tlsx509-chardev-verify.args | 4 +-
.../serial-tcp-tlsx509-chardev.args | 4 +-
.../serial-tcp-tlsx509-secret-chardev.args | 4 +-
.../qemuxml2argvdata/serial-udp-chardev.args | 4 +-
.../qemuxml2argvdata/serial-unix-chardev.args | 2 +-
tests/qemuxml2argvdata/serial-vc-chardev.args | 2 +-
tests/qemuxml2argvdata/user-aliases.args | 4 +-
tests/qemuxml2argvtest.c | 8 +++-
31 files changed, 191 insertions(+), 34 deletions(-)
create mode 100644 tests/qemuxml2argvdata/serial-dev-with-target-port.args
create mode 100644 tests/qemuxml2argvdata/serial-dev-with-target-port.xml
create mode 100644 tests/qemuxml2argvdata/serial-dev-without-target-port.args
create mode 100644 tests/qemuxml2argvdata/serial-dev-without-target-port.xml
I tried to 'git am -3' on top of current head - suffice to say with the
volume of change in the last couple of weeks - your patch won't apply
completely. So I need to ask you to regenerate and post as a v3 with a
couple of other thoughts as described below...
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 514c3ab2e..5f770404b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10291,6 +10291,22 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
virDomainChrSerialTargetModelTypeToString(serial->targetModel),
serial->info.alias, serial->info.alias);
+ switch ((virDomainChrSerialTargetModel) serial->targetModel) {
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
+ if (serial->target.port != -1)
+ virBufferAsprintf(&cmd, ",index=%d", serial->target.port);
+ break;
This has resulted in a *lot* of changed to .args files and it's really
not clear if "all" are really necessary...
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
+ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
Surprised that without the default: here you didn't get a compiler or
syntax-check complaint...
+ break;
+ }
+
if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) <
0)
goto error;
diff --git a/tests/qemuxml2argvdata/bios.args b/tests/qemuxml2argvdata/bios.args
index 048d4ff96..81e4a8ba7 100644
--- a/tests/qemuxml2argvdata/bios.args
+++ b/tests/qemuxml2argvdata/bios.args
@@ -24,6 +24,6 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev pty,id=charserial0 \
--device isa-serial,chardev=charserial0,id=serial0 \
+-device isa-serial,chardev=charserial0,id=serial0,index=0 \
For example, is there something special in
tests/qemuxml2argvdata/bios.xml that should cause index=0 to be added?
Is it really necessary for your use case... Thus,
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
will always result in this index=0... Is it necessary? Or is it only
necessary when there's multiple port possibilities? Or is it only
necessary when the port > 0? IOW: I believe qemu defaults to 0 if not
provided, so if one serial device and port==0, why provide this? When
did the index parameter show up and do we need a capability for it?
-device usb-tablet,id=input0,bus=usb.0,port=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/console-compat-auto.args
b/tests/qemuxml2argvdata/console-compat-auto.args
index cab47dbb5..3b048c721 100644
--- a/tests/qemuxml2argvdata/console-compat-auto.args
+++ b/tests/qemuxml2argvdata/console-compat-auto.args
@@ -22,5 +22,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/console-compat-chardev.args
b/tests/qemuxml2argvdata/console-compat-chardev.args
index ff7678ebc..61f5712bd 100644
--- a/tests/qemuxml2argvdata/console-compat-chardev.args
+++ b/tests/qemuxml2argvdata/console-compat-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/console-compat.args
b/tests/qemuxml2argvdata/console-compat.args
index fb96946f1..674c92696 100644
--- a/tests/qemuxml2argvdata/console-compat.args
+++ b/tests/qemuxml2argvdata/console-compat.args
@@ -22,4 +22,4 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev pty,id=charserial0 \
--device isa-serial,chardev=charserial0,id=serial0
+-device isa-serial,chardev=charserial0,id=serial0,index=0
diff --git a/tests/qemuxml2argvdata/console-virtio-many.args
b/tests/qemuxml2argvdata/console-virtio-many.args
index 58a8a1fa0..f050cbb25 100644
--- a/tests/qemuxml2argvdata/console-virtio-many.args
+++ b/tests/qemuxml2argvdata/console-virtio-many.args
@@ -24,7 +24,7 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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 70a8ba9ce..0e8c10f6d 100644
--- a/tests/qemuxml2argvdata/controller-order.args
+++ b/tests/qemuxml2argvdata/controller-order.args
@@ -33,7 +33,7 @@ id=drive-ide0-1-0,media=cdrom,readonly=on \
-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 \
diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.args
b/tests/qemuxml2argvdata/q35-virt-manager-basic.args
index c7dd514fe..83e6dde5f 100644
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.args
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.args
@@ -38,7 +38,7 @@ id=virtio-disk0 \
-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,\
nowait \
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
index 3a52b9efc..c19b05a18 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev tty,id=charserial0,path=/dev/ttyS2 \
--device isa-serial,chardev=charserial0,id=serial0,iobase=0x3f8,irq=0x4 \
+-device isa-serial,chardev=charserial0,id=serial0,index=0,iobase=0x3f8,irq=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev.args
b/tests/qemuxml2argvdata/serial-dev-chardev.args
index 55b939551..f78f51ab2 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev tty,id=charserial0,path=/dev/ttyS2 \
--device isa-serial,chardev=charserial0,id=serial0 \
+-device isa-serial,chardev=charserial0,id=serial0,index=1 \
So this one is different, but it's no different than the one I noted
above other than using 1 instead of 0 for the one console/serial port.
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev.xml
b/tests/qemuxml2argvdata/serial-dev-chardev.xml
index dffd27d06..329a0fc19 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev.xml
+++ b/tests/qemuxml2argvdata/serial-dev-chardev.xml
@@ -23,11 +23,11 @@
<controller type='ide' index='0'/>
<serial type='dev'>
<source path='/dev/ttyS2'/>
- <target port='0'/>
+ <target port='1'/>
</serial>
<console type='dev'>
<source path='/dev/ttyS2'/>
- <target port='0'/>
+ <target port='1'/>
Still one port being used - although perhaps something to key off - if
there's port > 0 we may want to write it out as that may be an
indication that we have more than one.
</console>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/serial-dev-with-target-port.args
b/tests/qemuxml2argvdata/serial-dev-with-target-port.args
new file mode 100644
index 000000000..c8626bf4f
--- /dev/null
+++ b/tests/qemuxml2argvdata/serial-dev-with-target-port.args
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-chardev tty,id=charserial0,path=/dev/ttyS2 \
+-device isa-serial,chardev=charserial0,id=serial0,index=1 \
+-chardev tty,id=charserial1,path=/dev/ttyS1 \
+-device isa-serial,chardev=charserial1,id=serial1,index=2 \
+-chardev tty,id=charserial2,path=/dev/ttyS3 \
+-device isa-serial,chardev=charserial2,id=serial2,index=3 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
Ahh... so here's the example you're targeting...
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/serial-dev-with-target-port.xml
b/tests/qemuxml2argvdata/serial-dev-with-target-port.xml
new file mode 100644
index 000000000..593ee5162
--- /dev/null
+++ b/tests/qemuxml2argvdata/serial-dev-with-target-port.xml
@@ -0,0 +1,38 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i686</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <serial type='dev'>
+ <source path='/dev/ttyS2'/>
+ <target port='1'/>
+ </serial>
+ <serial type='dev'>
+ <source path='/dev/ttyS1'/>
+ <target port='2'/>
+ </serial>
+ <serial type='dev'>
+ <source path='/dev/ttyS3'/>
+ <target port='3'/>
+ </serial>
and here there are multiple serial ports where the index then can be
used to "define" which goes with which, true?
Perhaps if there were corresponding "docs/formatdomain.html.in" changes
I'd have less questions... IOW: Usage of the port value to assign the
"order" of the ttySX...
No <console .../> here - no clear if it's required.
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/serial-dev-without-target-port.args
b/tests/qemuxml2argvdata/serial-dev-without-target-port.args
new file mode 100644
index 000000000..8e46260c7
--- /dev/null
+++ b/tests/qemuxml2argvdata/serial-dev-without-target-port.args
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-chardev tty,id=charserial0,path=/dev/ttyS2 \
+-device isa-serial,chardev=charserial0,id=serial0,index=0 \
+-chardev tty,id=charserial1,path=/dev/ttyS1 \
+-device isa-serial,chardev=charserial1,id=serial1,index=1 \
+-chardev tty,id=charserial2,path=/dev/ttyS3 \
+-device isa-serial,chardev=charserial2,id=serial2,index=2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/serial-dev-without-target-port.xml
b/tests/qemuxml2argvdata/serial-dev-without-target-port.xml
new file mode 100644
index 000000000..c170a111a
--- /dev/null
+++ b/tests/qemuxml2argvdata/serial-dev-without-target-port.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i686</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <serial type='dev'>
+ <source path='/dev/ttyS2'/>
+ </serial>
+ <serial type='dev'>
+ <source path='/dev/ttyS1'/>
+ </serial>
+ <serial type='dev'>
+ <source path='/dev/ttyS3'/>
+ </serial>
ah - so for this example you don't provide a port, but the result is
using index 0, 1, 2 instead of when you did provide a port where the
result was 1, 2, 3
No <console .../> here either...
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/serial-file-chardev.args
b/tests/qemuxml2argvdata/serial-file-chardev.args
index 47eb0aa9b..144ef37be 100644
--- a/tests/qemuxml2argvdata/serial-file-chardev.args
+++ b/tests/qemuxml2argvdata/serial-file-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/serial-file-log.args
b/tests/qemuxml2argvdata/serial-file-log.args
index 86f8e73e0..43a2d655b 100644
--- a/tests/qemuxml2argvdata/serial-file-log.args
+++ b/tests/qemuxml2argvdata/serial-file-log.args
@@ -23,4 +23,4 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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
diff --git a/tests/qemuxml2argvdata/serial-many-chardev.args
b/tests/qemuxml2argvdata/serial-many-chardev.args
index eed3d418c..e07d1e9b0 100644
--- a/tests/qemuxml2argvdata/serial-many-chardev.args
+++ b/tests/qemuxml2argvdata/serial-many-chardev.args
@@ -23,7 +23,7 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/serial-pty-chardev.args
b/tests/qemuxml2argvdata/serial-pty-chardev.args
index ff7678ebc..61f5712bd 100644
--- a/tests/qemuxml2argvdata/serial-pty-chardev.args
+++ b/tests/qemuxml2argvdata/serial-pty-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/serial-spiceport.args
b/tests/qemuxml2argvdata/serial-spiceport.args
index a3981499a..9bfa0450c 100644
--- a/tests/qemuxml2argvdata/serial-spiceport.args
+++ b/tests/qemuxml2argvdata/serial-spiceport.args
@@ -22,7 +22,7 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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 \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,\
diff --git a/tests/qemuxml2argvdata/serial-tcp-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-chardev.args
index 4c427e22c..79476c772 100644
--- a/tests/qemuxml2argvdata/serial-tcp-chardev.args
+++ b/tests/qemuxml2argvdata/serial-tcp-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
index 3ed08e95f..a0a4877a2 100644
--- a/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
+++ b/tests/qemuxml2argvdata/serial-tcp-telnet-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev socket,id=charserial0,host=127.0.0.1,port=9999,telnet,server,nowait \
--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=0x3
diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
index bd0feb319..1b92bf4a9 100644
--- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
+++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.args
@@ -24,7 +24,7 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
index ab5f7e27f..0b6363698 100644
--- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
+++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-verify.args
@@ -24,10 +24,10 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=yes \
-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=0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
index ab5f7e27f..0b6363698 100644
--- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
+++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev.args
@@ -24,10 +24,10 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=yes \
-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=0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
b/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
index 2567abbfa..58b7eca83 100644
--- a/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
+++ b/tests/qemuxml2argvdata/serial-tcp-tlsx509-secret-chardev.args
@@ -26,7 +26,7 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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 \
@@ -34,5 +34,5 @@ keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
endpoint=client,verify-peer=yes,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=0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/serial-udp-chardev.args
b/tests/qemuxml2argvdata/serial-udp-chardev.args
index c9db110e0..a671c5ed4 100644
--- a/tests/qemuxml2argvdata/serial-udp-chardev.args
+++ b/tests/qemuxml2argvdata/serial-udp-chardev.args
@@ -24,7 +24,7 @@ server,nowait \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/serial-unix-chardev.args
b/tests/qemuxml2argvdata/serial-unix-chardev.args
index df75e15fe..6b09e27ec 100644
--- a/tests/qemuxml2argvdata/serial-unix-chardev.args
+++ b/tests/qemuxml2argvdata/serial-unix-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-chardev socket,id=charserial0,path=/tmp/serial.sock \
--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=0x3
diff --git a/tests/qemuxml2argvdata/serial-vc-chardev.args
b/tests/qemuxml2argvdata/serial-vc-chardev.args
index 3438c8447..af4cac559 100644
--- a/tests/qemuxml2argvdata/serial-vc-chardev.args
+++ b/tests/qemuxml2argvdata/serial-vc-chardev.args
@@ -23,5 +23,5 @@ server,nowait \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-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=0x3
diff --git a/tests/qemuxml2argvdata/user-aliases.args
b/tests/qemuxml2argvdata/user-aliases.args
index ad9394710..5fa328828 100644
--- a/tests/qemuxml2argvdata/user-aliases.args
+++ b/tests/qemuxml2argvdata/user-aliases.args
@@ -59,9 +59,9 @@ addr=0xa \
-net socket,connect=127.0.0.1:1234,vlan=2,name=hostua-AndAlsoClientMode \
-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,\
nowait \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 165137e93..ca63886a6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1306,6 +1306,12 @@ mymain(void)
DO_TEST("serial-dev-chardev-iobase",
QEMU_CAPS_DEVICE_ISA_SERIAL,
QEMU_CAPS_NODEFCONFIG);
+ DO_TEST("serial-dev-with-target-port",
+ QEMU_CAPS_DEVICE_ISA_SERIAL,
+ QEMU_CAPS_NODEFCONFIG);
+ DO_TEST("serial-dev-without-target-port",
+ QEMU_CAPS_DEVICE_ISA_SERIAL,
+ QEMU_CAPS_NODEFCONFIG);
I don't thing this needs to use the new DO_TESTS_CAPS_{LATEST|VER}, but
it's not yet clear to me what prompts it's need. Since there's no
capabilities, I lean to no, but will defer to Peter if he requires it.
DO_TEST("serial-file-chardev",
QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_DEVICE_ISA_SERIAL,
@@ -1318,7 +1324,7 @@ mymain(void)
QEMU_CAPS_NODEFCONFIG);
DO_TEST("serial-udp-chardev",
QEMU_CAPS_DEVICE_ISA_SERIAL,
- QEMU_CAPS_NODEFCONFIG);
+ QEMU_CAPS_NODEFCONFIG);
^^^^^^^^^^
There is a spurious whitespace change at the end of the above line which
needs to be undone.
John
DO_TEST("serial-tcp-telnet-chardev",
QEMU_CAPS_DEVICE_ISA_SERIAL,
QEMU_CAPS_NODEFCONFIG);