[libvirt] [PATCHv3 5/5] qemu: autoadd iobase to debugcon chardev

Ján Tomko jtomko at redhat.com
Thu Feb 14 11:32:13 UTC 2019


If no address was provided, use QEMU's default of 0xE9 and reflect it
in the domain XML.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_domain.c                                   | 9 +++++++++
 .../isa-serial-debugcon.x86_64-latest.args               | 2 +-
 tests/qemuxml2argvdata/isa-serial-debugcon.xml           | 1 -
 tests/qemuxml2xmloutdata/isa-serial-debugcon.xml         | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9c4aedb009..7f8f8baa60 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6554,6 +6554,15 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
         }
     }
 
+    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
+        chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA &&
+        chr->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_DEBUGCON) {
+        if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+            chr->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA;
+            chr->info.addr.isa.iobase = 0xE9;
+        }
+    }
+
     return 0;
 }
 
diff --git a/tests/qemuxml2argvdata/isa-serial-debugcon.x86_64-latest.args b/tests/qemuxml2argvdata/isa-serial-debugcon.x86_64-latest.args
index f6a68277c4..c31c9910ff 100644
--- a/tests/qemuxml2argvdata/isa-serial-debugcon.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/isa-serial-debugcon.x86_64-latest.args
@@ -24,7 +24,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -no-acpi \
 -boot strict=on \
 -chardev pipe,id=charserial0,path=/tmp/debugcon \
--device isa-debugcon,chardev=charserial0,id=serial0,iobase=0x402 \
+-device isa-debugcon,chardev=charserial0,id=serial0,iobase=0xe9 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/isa-serial-debugcon.xml b/tests/qemuxml2argvdata/isa-serial-debugcon.xml
index 6c5de52585..2c66cd9915 100644
--- a/tests/qemuxml2argvdata/isa-serial-debugcon.xml
+++ b/tests/qemuxml2argvdata/isa-serial-debugcon.xml
@@ -15,7 +15,6 @@
       <target type='isa-serial' port='0'>
         <model name='debugcon'/>
       </target>
-      <address type='isa' iobase='0x402'/>
     </serial>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml b/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml
index 6ad7c3917c..4a575cac13 100644
--- a/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml
+++ b/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml
@@ -21,7 +21,7 @@
       <target type='isa-serial' port='0'>
         <model name='debugcon'/>
       </target>
-      <address type='isa' iobase='0x402'/>
+      <address type='isa' iobase='0xe9'/>
     </serial>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-- 
2.19.2




More information about the libvir-list mailing list