[libvirt] [PATCHv3 0/5] Implement debugcon chardev

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Apr 4 13:15:02 UTC 2019



On 04.04.2019 15:23, Nikolay Shirokovskiy wrote:
> 
> 
> On 14.02.2019 14:32, Ján Tomko wrote:
>> v2: https://www.redhat.com/archives/libvir-list/2019-February/msg00293.html
>> v3:
>>   * dropped the pointless isa-prefix
>>   * use DO_TEST_CAPS_LATEST
>>   * trimmed the XML
>>   * compiles with gcc
>>   * only make irq optional
>>   * autofill iobase
>>
>> Ján Tomko (3):
>>   qemu: introduce qemuDomainChrSerialTargetModel
>>   qemu: make irq optional when formatting the ISA address
>>   qemu: autoadd iobase to debugcon chardev
>>
>> Nikolay Shirokovskiy (2):
>>   conf: add debugcon chardev guest interface
>>   qemu: implement debugcon chardev
>>
>>  docs/formatdomain.html.in                     |  3 +-
>>  docs/schemas/domaincommon.rng                 |  1 +
>>  src/conf/domain_conf.c                        |  5 ++++
>>  src/conf/domain_conf.h                        |  1 +
>>  src/qemu/qemu_command.c                       | 25 +++++++++++++---
>>  src/qemu/qemu_domain.c                        | 12 ++++++++
>>  .../isa-serial-debugcon.x86_64-latest.args    | 30 +++++++++++++++++++
>>  .../qemuxml2argvdata/isa-serial-debugcon.xml  | 21 +++++++++++++
>>  tests/qemuxml2argvtest.c                      |  1 +
>>  .../isa-serial-debugcon.xml                   | 30 +++++++++++++++++++
>>  tests/qemuxml2xmltest.c                       |  2 ++
>>  11 files changed, 126 insertions(+), 5 deletions(-)
>>  create mode 100644 tests/qemuxml2argvdata/isa-serial-debugcon.x86_64-latest.args
>>  create mode 100644 tests/qemuxml2argvdata/isa-serial-debugcon.xml
>>  create mode 100644 tests/qemuxml2xmloutdata/isa-serial-debugcon.xml
>>
> 
> I forget to mention that there is still an issue with console alias that need to be addressed:
> 
> https://www.redhat.com/archives/libvir-list/2019-February/msg00608.html
> 
> I could send it.
> 
> 

Next patch fixes the issue by inserting extra serial if the first one is debugcon.

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b2dd281..1d69c88 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4394,7 +4394,8 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def)
         (def->consoles[0]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ||
          def->consoles[0]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)) {
 
-        /* If there isn't a corresponding serial port:
+        /* If there isn't a corresponding serial port or the first serial port
+         * is used for debugcon:
          *  - create one and set, the console to be an alias for it
          *
          * If there is a corresponding serial port:
@@ -4404,8 +4405,11 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def)
          */
 
         /* create the serial port definition from the console definition */
-        if (def->nserials == 0) {
-            if (VIR_APPEND_ELEMENT(def->serials,
+        if (def->nserials == 0 ||
+            (def->serials[0]->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA &&
+             def->serials[0]->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_DEBUGCON)) {
+            if (VIR_INSERT_ELEMENT(def->serials,
+                                   0,
                                    def->nserials,
                                    def->consoles[0]) < 0)
                 return -1;




More information about the libvir-list mailing list