[libvirt] [PATCH v2 2/2] qemu: implement debugcon-isa chardev

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Feb 7 11:31:49 UTC 2019


Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
---
 src/qemu/qemu_command.c                         |  8 ++++---
 tests/qemuxml2argvdata/isa-serial-debugcon.args | 29 +++++++++++++++++++++++++
 tests/qemuxml2argvtest.c                        |  1 +
 3 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/isa-serial-debugcon.args

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index aeab619..862bb2e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -393,9 +393,11 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
                               info->addr.ccw.ssid,
                               info->addr.ccw.devno);
     } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) {
-        virBufferAsprintf(buf, ",iobase=0x%x,irq=0x%x",
-                          info->addr.isa.iobase,
-                          info->addr.isa.irq);
+        if (info->addr.isa.iobase)
+            virBufferAsprintf(buf, ",iobase=0x%x", info->addr.isa.iobase);
+
+        if (info->addr.isa.irq)
+            virBufferAsprintf(buf, ",irq=0x%x", info->addr.isa.irq);
     }
 
     ret = 0;
diff --git a/tests/qemuxml2argvdata/isa-serial-debugcon.args b/tests/qemuxml2argvdata/isa-serial-debugcon.args
new file mode 100644
index 0000000..c7faab4
--- /dev/null
+++ b/tests/qemuxml2argvdata/isa-serial-debugcon.args
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-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,\
+bootindex=1 \
+-chardev pipe,id=charserial0,path=/tmp/debugcon \
+-device isa-debugcon,chardev=charserial0,id=serial0,iobase=0x402 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6dc05c3..3569391 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1490,6 +1490,7 @@ mymain(void)
             QEMU_CAPS_DEVICE_ISA_SERIAL);
     DO_TEST("pci-serial-dev-chardev",
             QEMU_CAPS_DEVICE_PCI_SERIAL);
+    DO_TEST("isa-serial-debugcon", NONE);
 
     DO_TEST("channel-guestfwd", NONE);
     DO_TEST_CAPS_VER("channel-unix-guestfwd", "2.5.0");
-- 
1.8.3.1




More information about the libvir-list mailing list