From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 151186971613585.76701289355526; Tue, 28 Nov 2017 03:48:36 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B3E613AA2; Tue, 28 Nov 2017 11:48:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4FBF5D9C6; Tue, 28 Nov 2017 11:48:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D8FC4A467; Tue, 28 Nov 2017 11:48:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmO20008630 for ; Tue, 28 Nov 2017 06:48:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 01A3A60175; Tue, 28 Nov 2017 11:48:24 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0760A60176 for ; Tue, 28 Nov 2017 11:48:22 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:44 +0100 Message-Id: <20171128114813.28509-2-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 01/30] docs: Improve documentation for serial consoles X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Nov 2017 11:48:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Our current documentation is missing some information and doesn't do a great job at explaining how the and elements are connected. Let's try to fix that. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- docs/formatdomain.html.in | 214 ++++++++++++++++++++++++++++++++++--------= ---- 1 file changed, 159 insertions(+), 55 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 505676354..84cfe35a9 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6518,77 +6518,68 @@ qemu-kvm -net nic,model=3D? /dev/null
 ...
 <devices>
+  <!-- Serial port -->
   <serial type=3D'pty'>
     <source path=3D'/dev/pts/3'/>
     <target port=3D'0'/>
   </serial>
 </devices>
+...
+ +
+...
+<devices>
+  <!-- USB serial port -->
+  <serial type=3D'pty'>
+    <target type=3D'usb-serial' port=3D'0'/>
+    <address type=3D'usb' bus=3D'0' port=3D'1'/>
+  </serial>
+</devices>
 ...
=20

- target can have a port attribute, which - specifies the port number. Ports are numbered starting from 0. There= are - usually 0, 1 or 2 serial ports. There is also an optional - type attribute since 1.0.2 - which has three choices for its value, one is isa-serial, - then usb-serial and last one is pci-serial. - If type is missing, isa-serial will be use= d by - default. For usb-serial an optional sub-element - <address/> with type=3D'usb' can tie= the - device to a particular controller, docu= mented above. - Similarly, pci-serial can be used to attach the device = to - the pci bus (since 1.2.16). Again, it h= as - optional sub-element <address/> with - type=3D'pci' to select desired location on the PCI bus. + The target element can have an optional port + attribute, which specifies the port number (starting from 0), and an + optional type attribute: valid values are, + since 1.0.2, isa-serial (u= sable + with x86 guests), usb-serial (usable whenever USB suppo= rt + is available) and pci-serial (usable whenever PCI suppo= rt + is available).

=20 -
Console
-

- The console element is used to represent interactive consoles. Depen= ding - on the type of guest in use, the consoles might be paravirtualized d= evices, - or they might be a clone of a serial device, according to the follow= ing - rules: + If any of the attributes is not specified by the user, libvirt will + choose a value suitable for most users.

=20 -
    -
  • If no targetType attribute is set, then the default - device type is according to the hypervisor's rules. The default - type will be added when re-querying the XML fed into libvirt. - For fully virtualized guests, the default device type will usually - be a serial port.
  • -
  • If the targetType attribute is serial, - then if no <serial> element exists, the console - element will be copied to the serial element. If a <seria= l> - element does already exist, the console element will be ignored. -
  • If the targetType attribute is not serial, - it will be treated normally.
  • -
  • Only the first console element may use a targ= etType - of serial. Secondary consoles must all be paravirtual= ized. -
  • -
  • On S390, the console element may use a - targetType of sclp or sclplm - (line mode). SCLP is the native console type for S390. There's no - controller associated to SCLP consoles. - Since 1.0.2 -
  • -
+

+ All of the target types support configuring the guest-visible device + address as documented above; more + specifically, acceptable address types are isa (for + isa-serial), usb (for usb-serial) + and pci (for pci-serial). +

=20

- A virtio console device is exposed in the - guest as /dev/hvc[0-7] (for more information, see - http= ://fedoraproject.org/wiki/Features/VirtioSerial) - Since 0.8.3 + For the relationship between serial ports and consoles, + see below.

=20 +
Console
+
 ...
 <devices>
+  <!-- Serial console -->
   <console type=3D'pty'>
-    <source path=3D'/dev/pts/4'/>
-    <target port=3D'0'/>
+    <source path=3D'/dev/pts/2'/>
+    <target type=3D'serial' port=3D'0'/>
   </console>
+</devices>
+...
=20 +
+...
   <!-- KVM virtio console -->
   <console type=3D'pty'>
     <source path=3D'/dev/pts/5'/>
@@ -6597,21 +6588,134 @@ qemu-kvm -net nic,model=3D? /dev/null
 </devices>
 ...
=20 +

+ The console element is used to represent interactive + serial consoles. Depending on the type of guest in use and the speci= fics + of the configuration, the console element might represe= nt + the same device as an existing serial element or a sepa= rate + device. +

+ +

+ A target subelement is supported and works the same + way as with the serial element + (see above for details). + Valid values for the type attribute are: + serial (described below); + virtio (usable whenever VirtIO support is available); + xen, lxc, uml and + openvz (available when the corresponding hypervisor is = in + use); sclp and sclplm (usable for s390 and + s390x QEMU guests). +

+ +

+ Of the target types listed above, serial is special in + that it doesn't represents a separate device, but rather the same + device as the first serial element. Due to this, there = can + only be a single console element with target type + serial per guest. +

+ +

+ Virtio consoles are usually accessible as /dev/hvc[0-7] + from inside the guest; for more information, see + http= ://fedoraproject.org/wiki/Features/VirtioSerial. + Since 0.8.3 +

+ +

+ For the relationship between serial ports and consoles, + see below. +

+ +
Relationship between serial = ports and consoles
+ +

+ Due to hystorical reasons, the serial and + console elements have partially overlapping scopes. +

+ +

+ In general, both elements are used to configure one or more serial + consoles to be used for interacting with the guest. The main differe= nce + between the two is that serial is used for emulated, + usually native, serial consoles, whereas console is used + for paravirtualized ones. +

+ +

+ Both emulated and paravirtualized serial consoles have advantages and + disadvantages: +

+ +
    +
  • + emulated serial consoles are usually initialized much earlier than + paravirtualized ones, so they can be used to control the bootloader + and display both firmware and early boot messages; +
  • +
  • + on several platforms, there can only be a single emulated serial + console per guest but paravirtualized consoles don't suffer from t= he + same limitation. +
  • +
+ +

+ A configuration such as: +

+
 ...
-<devices>
-  <!-- KVM S390 sclp console -->
+</devices>
+  <console type=3D'pty'>
+    <target type=3D'serial'/>
+  </console>
   <console type=3D'pty'>
-    <source path=3D'/dev/pts/1'/>
-    <target type=3D'sclp' port=3D'0'/>
+    <target type=3D'virtio'/>
   </console>
 </devices>
 ...
=20

- If the console is presented as a serial port, the target - element has the same attributes as for a serial port. There is usual= ly - only 1 console. + will work on any platform and will result in one emulated serial con= sole + for early boot logging / interactive / recovery use, and one + paravirtualized serial console to be used eg. as a side channel. Most + people will be fine with having just the first console + element in their configuration. +

+ +

+ Note that, due to the compatibility concerns mentioned earlier, all = the + following configurations: +

+ +
+...
+</devices>
+  <serial type=3D'pty'/>
+</devices>
+...
+ +
+...
+</devices>
+  <console type=3D'pty'/>
+</devices>
+...
+ +
+...
+</devices>
+  <serial type=3D'pty'/>
+  <console type=3D'pty'/>
+</devices>
+...
+ +

+ will be treated the same and will result in a single emulated serial + console being available to the guest.

=20
Channel
--=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869724729695.8955532063569; Tue, 28 Nov 2017 03:48:44 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B09AC37E6E; Tue, 28 Nov 2017 11:48:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A67B5D965; Tue, 28 Nov 2017 11:48:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 51BD21800FC4; Tue, 28 Nov 2017 11:48:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmPXi008639 for ; Tue, 28 Nov 2017 06:48:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 696D260176; Tue, 28 Nov 2017 11:48:25 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9585E60175 for ; Tue, 28 Nov 2017 11:48:24 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:45 +0100 Message-Id: <20171128114813.28509-3-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 02/30] qemu: Introduce qemuDomainChrDefPostParse() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Nov 2017 11:48:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Having a separate function for char device handling is better than adding even more code to qemuDomainDeviceDefPostParse(). Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina Reviewed-by: Marc Hartmayer --- src/qemu/qemu_domain.c | 57 ++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9dab6b24b..e59aedcfd 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4086,6 +4086,35 @@ qemuDomainControllerDefPostParse(virDomainController= DefPtr cont, return 0; } =20 +static int +qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + const virDomainDef *def, + virQEMUDriverPtr driver, + unsigned int parseFlags) +{ + /* set the default console type for S390 arches */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && + chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE && + ARCH_IS_S390(def->os.arch)) { + chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; + } + + /* clear auto generated unix socket path for inactive definitions */ + if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { + if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) + return -1; + + /* For UNIX chardev if no path is provided we generate one. + * This also implies that the mode is 'bind'. */ + if (chr->source && + chr->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_UNIX && + !chr->source->data.nix.path) { + chr->source->data.nix.listen =3D true; + } + } + + return 0; +} =20 static int qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, @@ -4146,29 +4175,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, } } =20 - /* set the default console type for S390 arches */ - if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CHR && - dev->data.chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOL= E && - dev->data.chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYP= E_NONE && - ARCH_IS_S390(def->os.arch)) - dev->data.chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_V= IRTIO; - - /* clear auto generated unix socket path for inactive definitions */ - if ((parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && - dev->type =3D=3D VIR_DOMAIN_DEVICE_CHR) { - virDomainChrDefPtr chr =3D dev->data.chr; - if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) - goto cleanup; - - /* For UNIX chardev if no path is provided we generate one. - * This also implies that the mode is 'bind'. */ - if (chr->source && - chr->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_UNIX && - !chr->source->data.nix.path) { - chr->source->data.nix.listen =3D true; - } - } - if (dev->type =3D=3D VIR_DOMAIN_DEVICE_VIDEO) { if (dev->data.video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT) { if ARCH_IS_PPC64(def->os.arch) @@ -4204,6 +4210,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, qemuDomainShmemDefPostParse(dev->data.shmem) < 0) goto cleanup; =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CHR && + qemuDomainChrDefPostParse(dev->data.chr, def, driver, parseFlags) = < 0) { + goto cleanup; + } + ret =3D 0; =20 cleanup: --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869723702924.0621443986449; Tue, 28 Nov 2017 03:48:43 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B101D4E33B; Tue, 28 Nov 2017 11:48:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86AEE60BE5; Tue, 28 Nov 2017 11:48:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 51E7A3FCFB; Tue, 28 Nov 2017 11:48:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmQAt008647 for ; Tue, 28 Nov 2017 06:48:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id ECD1460175; Tue, 28 Nov 2017 11:48:26 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09E1C60176 for ; Tue, 28 Nov 2017 11:48:25 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:46 +0100 Message-Id: <20171128114813.28509-4-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 03/30] conf: Run devicePostParse() again for the first serial device X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:48:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The devicePostParse() callback is invoked for all devices so that drivers have a chance to set their own specific values; however, virDomainDefAddImplicitDevices() runs *after* the devicePostParse() callbacks have been invoked and can add new devices, in which case the driver wouldn't have a chance to customize them. Work around the issue by invoking the devicePostParse() callback after virDomainDefAddImplicitDevices(), only for the first serial devices, which might have been added by it. The same was already happening for the first video device for the very same reason. This will become important later on, when we will change virDomainDefAddConsoleCompat() not to set a targetType for automatically added serial devices. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 66536653b..83c121b02 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4946,6 +4946,18 @@ virDomainDefPostParseCommon(virDomainDefPtr def, return -1; } =20 + if (def->nserials !=3D 0) { + virDomainDeviceDef device =3D { + .type =3D VIR_DOMAIN_DEVICE_CHR, + .data.chr =3D def->serials[0], + }; + + /* serials[0] might have been added in AddImplicitDevices, after w= e've + * done the per-device post-parse */ + if (virDomainDefPostParseDeviceIterator(def, &device, NULL, data) = < 0) + return -1; + } + /* clean up possibly duplicated metadata entries */ virXMLNodeSanitizeNamespaces(def->metadata); =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869727545703.8815489781796; Tue, 28 Nov 2017 03:48:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 342E44E4C8; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FE1851C40; Tue, 28 Nov 2017 11:48:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D17773894; Tue, 28 Nov 2017 11:48:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmUwj008665 for ; Tue, 28 Nov 2017 06:48:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id EB56660462; Tue, 28 Nov 2017 11:48:30 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06C3760176 for ; Tue, 28 Nov 2017 11:48:27 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:47 +0100 Message-Id: <20171128114813.28509-5-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 04/30] conf: Introduce VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:48:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is the first step in getting rid of the assumption that isa-serial is the default target type for serial devices. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 8 +++++--- src/conf/domain_conf.h | 3 ++- src/qemu/qemu_command.c | 13 +++++++++++++ src/qemu/qemu_domain.c | 21 +++++++++++++++++++++ src/qemu/qemu_domain_address.c | 1 + 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 83c121b02..1b11d39b5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -448,6 +448,7 @@ VIR_ENUM_IMPL(virDomainChrDeviceState, VIR_DOMAIN_CHR_D= EVICE_STATE_LAST, =20 VIR_ENUM_IMPL(virDomainChrSerialTarget, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST, + "none", "isa-serial", "usb-serial", "pci-serial") @@ -4023,7 +4024,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) =20 /* modify it to be a serial port */ def->serials[0]->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SER= IAL; - def->serials[0]->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_T= YPE_ISA; + def->serials[0]->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_T= YPE_NONE; def->serials[0]->target.port =3D 0; } else { /* if the console source doesn't match */ @@ -4047,7 +4048,8 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) def->serials[0]->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TY= PE_SERIAL) { =20 switch ((virDomainChrSerialTargetType) def->serials[0]->targetType= ) { - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { =20 /* Create a stub console to match the serial port. * console[0] either does not exist @@ -11493,7 +11495,7 @@ virDomainChrDefaultTargetType(int devtype) return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: - return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index dabbff1c2..83b6e9ee5 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1077,7 +1077,8 @@ typedef enum { } virDomainChrDeviceType; =20 typedef enum { - VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA =3D 0, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE =3D 0, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0eb591253..81c652cc3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9259,6 +9259,14 @@ qemuChrIsPlatformDevice(const virDomainDef *def, return true; } =20 + /* If we got all the way here and we're still stuck with the default + * target type for a serial device, it means we have no clue what kind= of + * device we're talking about and we must treat it as a platform devic= e. */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + return true; + } + return false; } =20 @@ -10407,7 +10415,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Except from _LAST, which is just a guard value and will nev= er + * be used, all of the above are platform devices, which means + * qemuBuildSerialCommandLine() will have taken the appropriate + * branch and we will not have ended up here. */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid target type for serial device")); goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e59aedcfd..20e862a7b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4099,6 +4099,27 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; } =20 + /* Historically, isa-serial and the default matched, so in order to + * maintain backwards compatibility we map them here. The actual defau= lt + * will be picked below based on the architecture and machine type. */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) { + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + } + + /* Set the default serial type */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + if (ARCH_IS_X86(def->os.arch)) { + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + } else if (qemuDomainIsPSeries(def)) { + /* Setting TYPE_ISA here is just a temporary hack to reduce te= st + * suite churn. Later on we will have a proper serial type for + * pSeries and this line will be updated accordingly. */ + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + } + } + /* clear auto generated unix socket path for inactive definitions */ if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7f4ac0f45..989c0e6c9 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -782,6 +782,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: return 0; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869733810232.6408751066043; Tue, 28 Nov 2017 03:48:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C29F180484; Tue, 28 Nov 2017 11:48:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A09160BE5; Tue, 28 Nov 2017 11:48:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 58B82180474E; Tue, 28 Nov 2017 11:48:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmX9X008675 for ; Tue, 28 Nov 2017 06:48:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1CC1D600D1; Tue, 28 Nov 2017 11:48:33 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9656360462 for ; Tue, 28 Nov 2017 11:48:31 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:48 +0100 Message-Id: <20171128114813.28509-6-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 05/30] conf: Drop virDomainChrDeviceType.targetTypeAttr X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 28 Nov 2017 11:48:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This attribute was used to decide whether to format the type attribute of the element, but the logic didn't take into account all possible cases and as such could lead to unexpected results. Moreover, it's one more thing to keep track of, and can easily fall out of sync with other attributes. Now that we have VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE, we can use that value to signal that no specific target type has been configured for the serial device and as such the attribute should not be formatted at all. All other values are now formatted. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 11 ++++---= ---- src/conf/domain_conf.h | 1 - src/vz/vz_sdk.c | 3 +-- tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml | 4 ++-- tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml | 4 ++-- tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml | 2 +- .../qemuhotplug-console-compat-2-live+console-virtio.xml | 4 ++-- .../qemuhotplug-console-compat-2-live.xml | 4 ++-- .../qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 4 ++-- .../qemuxml2xmlout-bios-nvram-os-interleave.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml | 4 ++-- .../qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml | 4 ++-- tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml | 2 +- .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml | 2 +- .../qemuxml2xmlout-pseries-panic-missing.xml | 2 +- .../qemuxml2xmlout-pseries-panic-no-address.xml | 2 +- .../qemuxml2xmlout-q35-virt-manager-basic.xml | 2 +- .../qemuxml2xmlout-serial-spiceport-nospice.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-serial-target-port-auto.xml | 6 +++--- .../qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml | 4 ++-- .../qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml | 2 +- 43 files changed, 56 insertions(+), 61 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1b11d39b5..6ba6f923c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11507,8 +11507,7 @@ virDomainChrDefaultTargetType(int devtype) } =20 static int -virDomainChrTargetTypeFromString(virDomainChrDefPtr def, - int devtype, +virDomainChrTargetTypeFromString(int devtype, const char *targetType) { int ret =3D -1; @@ -11536,8 +11535,6 @@ virDomainChrTargetTypeFromString(virDomainChrDefPtr= def, break; } =20 - def->targetTypeAttr =3D true; - return ret; } =20 @@ -11554,7 +11551,7 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr de= f, char *stateStr =3D NULL; =20 if ((def->targetType =3D - virDomainChrTargetTypeFromString(def, def->deviceType, + virDomainChrTargetTypeFromString(def->deviceType, targetType)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown target type '%s' specified for character= device"), @@ -16474,7 +16471,7 @@ virDomainChrEquals(virDomainChrDefPtr src, break; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: - if (src->targetTypeAttr !=3D tgt->targetTypeAttr) + if (src->targetType !=3D tgt->targetType) return false; =20 ATTRIBUTE_FALLTHROUGH; @@ -24035,7 +24032,7 @@ virDomainChrDefFormat(virBufferPtr buf, break; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: - if (def->targetTypeAttr) { + if (def->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { virBufferAsprintf(buf, "\n", virDomainChrTargetTypeToString(def->deviceTy= pe, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 83b6e9ee5..ac6c4a0ed 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1203,7 +1203,6 @@ struct _virDomainChrSourceDef { struct _virDomainChrDef { int deviceType; /* enum virDomainChrDeviceType */ =20 - bool targetTypeAttr; int targetType; /* enum virDomainChrConsoleTargetType || enum virDomainChrChannelTargetType || enum virDomainChrSerialTargetType according to devi= ceType */ diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 819b02b1e..eea5f6fc6 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1191,7 +1191,6 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainC= hrDefPtr chr) int ret =3D -1; =20 chr->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; - chr->targetTypeAttr =3D false; pret =3D PrlVmDev_GetIndex(serialPort, &serialPortIndex); prlsdkCheckRetGoto(pret, cleanup); chr->target.port =3D serialPortIndex; @@ -2864,7 +2863,7 @@ static int prlsdkCheckSerialUnsupportedParams(virDoma= inChrDefPtr chr) return -1; } =20 - if (chr->targetTypeAttr) { + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Specified character device target type is not " "supported by vz driver.")); diff --git a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml b/tests= /qemuargv2xmldata/qemuargv2xml-console-compat.xml index f51284442..7c106f145 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml @@ -28,7 +28,7 @@
- + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-dev.xml index aac814d59..e76d0211d 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-file.xml index 64819a48a..ed67ada0d 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-many.xml index e00afe317..420771dc9 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml @@ -28,11 +28,11 @@
- + - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-pty.xml index f51284442..7c106f145 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml @@ -28,7 +28,7 @@
- + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml b/te= sts/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml index c35a4ca73..3fe61ffa0 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml @@ -30,7 +30,7 @@ - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-tcp.xml index 0d218f548..3fc9fd39b 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml @@ -30,7 +30,7 @@ - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-udp.xml index f7069d541..5b4af3fe9 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml @@ -30,11 +30,11 @@ - + - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-unix.xml index 14fc8fc7c..6bb291ff7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml b/tests/qemu= argv2xmldata/qemuargv2xml-serial-vc.xml index 95aa1c7b9..41954fc85 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml @@ -28,7 +28,7 @@
- + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live= +console-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-comp= at-2-live+console-virtio.xml index 4e1dd49c2..427f431cc 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+consol= e-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+consol= e-virtio.xml @@ -72,13 +72,13 @@ - + - + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live= .xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml index c56d13ef4..144f6eff7 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml @@ -72,13 +72,13 @@ - + - + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev= -notls.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev= -notls.xml index a95e29ad8..e6c4adb6f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.= xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.= xml @@ -29,12 +29,12 @@ - + - + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml b/tests/q= emuxml2argvdata/qemuxml2argv-user-aliases.xml index c760098fe..f9724d320 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml @@ -110,10 +110,10 @@
- + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interlea= ve.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.x= ml index 033e86d3a..5ee73b527 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml @@ -33,7 +33,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml index 840bf69f6..ad77f62d9 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml @@ -25,13 +25,13 @@ - + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml index e76f857ae..cd9d75c4b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml @@ -27,7 +27,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml b/t= ests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml index 8dc361dfc..0c0bd7b34 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml @@ -28,7 +28,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml b/= tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml index 858b2c675..305c53eab 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml @@ -31,7 +31,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml index f9f9abd2d..b38b3ce98 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml @@ -30,7 +30,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml b= /tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml index 1c5501767..06192fbb4 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml @@ -47,7 +47,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b= /tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml index 95b6e2df1..a6eaa3807 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml @@ -104,10 +104,10 @@
- + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml index 7fe69bd6c..e6ad23424 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml @@ -55,7 +55,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/t= ests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml index b631e5b51..66448ec3d 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml @@ -44,7 +44,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml b/tes= ts/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml index fd5fdbece..b1240b8ed 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml @@ -57,7 +57,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml b/tests/qe= muxml2xmloutdata/qemuxml2xmlout-net-mtu.xml index 4571b6a82..4f7ad323e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml @@ -54,7 +54,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml index 7fb49feb0..a563b6ddd 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml @@ -22,7 +22,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-pow= er9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9= .xml index f02005621..59587b3c3 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml @@ -25,7 +25,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml index 3cbce9fe6..a39e1fd01 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml @@ -25,7 +25,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml = b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml index d69b38768..666eede1a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml @@ -26,7 +26,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.= xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml index 7fb49feb0..a563b6ddd 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml @@ -22,7 +22,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-addre= ss.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.x= ml index 7fb49feb0..a563b6ddd 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml @@ -22,7 +22,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic= .xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml index c4ccd98aa..27baaa3f1 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml @@ -79,7 +79,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospi= ce.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.x= ml index 79c4ebc73..63462e6f9 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml @@ -28,7 +28,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b= /tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml index 9527b2d15..c90bbeb7d 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml @@ -28,7 +28,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-aut= o.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml index 71516a31a..a8790b509 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml @@ -27,13 +27,13 @@ - + - + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-cha= rdev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chard= ev.xml index 18f51e538..a8af87b53 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml @@ -29,12 +29,12 @@ - + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml index a6be7542c..f439f57ea 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -42,7 +42,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/= qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml index 7787befb8..a2a6e5b3c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml @@ -48,7 +48,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml b/tes= ts/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml index 8c27470dd..72cbcc4cb 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml @@ -46,7 +46,7 @@
- + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869733724674.386613040323; Tue, 28 Nov 2017 03:48:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE95C61488; Tue, 28 Nov 2017 11:48:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 803005D75F; Tue, 28 Nov 2017 11:48:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4429E180474B; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmYbd008683 for ; Tue, 28 Nov 2017 06:48:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9EBD26047F; Tue, 28 Nov 2017 11:48:34 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0460600D1 for ; Tue, 28 Nov 2017 11:48:33 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:49 +0100 Message-Id: <20171128114813.28509-7-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 06/30] conf: Introduce virDomainChrTargetDefFormat() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 28 Nov 2017 11:48:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move formatting of the element for char devices out of virDomainChrDefFormat() and into its own function. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 67 ++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6ba6f923c..c0e239def 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23945,38 +23945,15 @@ virDomainChrSourceDefFormat(virBufferPtr buf, return -1; } =20 + static int -virDomainChrDefFormat(virBufferPtr buf, - virDomainChrDefPtr def, - unsigned int flags) +virDomainChrTargetDefFormat(virBufferPtr buf, + const virDomainChrDef *def, + unsigned int flags) { - const char *elementName =3D virDomainChrDeviceTypeToString(def->device= Type); const char *targetType =3D virDomainChrTargetTypeToString(def->deviceT= ype, def->targetTyp= e); - bool tty_compat; - - int ret =3D 0; - - if (!elementName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected char device type %d"), - def->deviceType); - return -1; - } =20 - virBufferAsprintf(buf, "<%s", elementName); - virBufferAdjustIndent(buf, 2); - tty_compat =3D (def->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONS= OLE && - def->target.port =3D=3D 0 && - def->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_PTY && - !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && - def->source->data.file.path); - if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0) - return -1; - virBufferAddLit(buf, ">\n"); - virDomainChrSourceDefFormat(buf, def->source, flags); - - /* Format block */ switch (def->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: { if (!targetType) { @@ -24048,6 +24025,42 @@ virDomainChrDefFormat(virBufferPtr buf, break; } =20 + return 0; +} + + +static int +virDomainChrDefFormat(virBufferPtr buf, + virDomainChrDefPtr def, + unsigned int flags) +{ + const char *elementName =3D virDomainChrDeviceTypeToString(def->device= Type); + bool tty_compat; + + int ret =3D 0; + + if (!elementName) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected char device type %d"), + def->deviceType); + return -1; + } + + virBufferAsprintf(buf, "<%s", elementName); + virBufferAdjustIndent(buf, 2); + tty_compat =3D (def->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONS= OLE && + def->target.port =3D=3D 0 && + def->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_PTY && + !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && + def->source->data.file.path); + if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0) + return -1; + virBufferAddLit(buf, ">\n"); + virDomainChrSourceDefFormat(buf, def->source, flags); + + if (virDomainChrTargetDefFormat(buf, def, flags) < 0) + return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869727690385.76783104978904; Tue, 28 Nov 2017 03:48:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65F125D68C; Tue, 28 Nov 2017 11:48:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 399B75D759; Tue, 28 Nov 2017 11:48:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EE6B01800BD3; Tue, 28 Nov 2017 11:48:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmapa008691 for ; Tue, 28 Nov 2017 06:48:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 14C0E600D1; Tue, 28 Nov 2017 11:48:36 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 360E560462 for ; Tue, 28 Nov 2017 11:48:34 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:50 +0100 Message-Id: <20171128114813.28509-8-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 07/30] conf: Improve error handling in virDomainChrDefFormat() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 28 Nov 2017 11:48:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We don't need to store the return value since we never modify it. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c0e239def..cb98631fb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24037,8 +24037,6 @@ virDomainChrDefFormat(virBufferPtr buf, const char *elementName =3D virDomainChrDeviceTypeToString(def->device= Type); bool tty_compat; =20 - int ret =3D 0; - if (!elementName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected char device type %d"), @@ -24059,14 +24057,14 @@ virDomainChrDefFormat(virBufferPtr buf, virDomainChrSourceDefFormat(buf, def->source, flags); =20 if (virDomainChrTargetDefFormat(buf, def, flags) < 0) - return -1; + return -1; =20 virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAsprintf(buf, "\n", elementName); =20 - return ret; + return 0; } =20 static int --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869734406681.5434543373626; Tue, 28 Nov 2017 03:48:54 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E51F785543; Tue, 28 Nov 2017 11:48:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9E046060D; Tue, 28 Nov 2017 11:48:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8108F3D380; Tue, 28 Nov 2017 11:48:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmdVJ008706 for ; Tue, 28 Nov 2017 06:48:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 58EF960176; Tue, 28 Nov 2017 11:48:39 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AF4B600D1 for ; Tue, 28 Nov 2017 11:48:36 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:51 +0100 Message-Id: <20171128114813.28509-9-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 08/30] conf: Check virDomainChrSourceDefFormat() return value X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 28 Nov 2017 11:48:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function can fail, but none of the caller were accounting for that. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cb98631fb..4bae0cc94 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24054,7 +24054,9 @@ virDomainChrDefFormat(virBufferPtr buf, if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0) return -1; virBufferAddLit(buf, ">\n"); - virDomainChrSourceDefFormat(buf, def->source, flags); + + if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0) + return -1; =20 if (virDomainChrTargetDefFormat(buf, def, flags) < 0) return -1; @@ -24075,13 +24077,14 @@ virDomainSmartcardDefFormat(virBufferPtr buf, const char *mode =3D virDomainSmartcardTypeToString(def->type); virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; size_t i; + int ret =3D -1; =20 virBufferSetChildIndent(&childBuf, buf); =20 if (!mode) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected smartcard type %d"), def->type); - return -1; + goto cleanup; } =20 switch (def->type) { @@ -24098,23 +24101,25 @@ virDomainSmartcardDefFormat(virBufferPtr buf, break; =20 case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: - virDomainChrSourceDefFormat(&childBuf, def->data.passthru, flags); + if (virDomainChrSourceDefFormat(&childBuf, def->data.passthru, fla= gs) < 0) + goto cleanup; break; =20 default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected smartcard type %d"), def->type); - return -1; + goto cleanup; } virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 if (virBufferCheckError(&childBuf) < 0) - return -1; + goto cleanup; =20 virBufferAsprintf(buf, "type =3D=3D VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH && - virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) - return -1; + virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) { + goto cleanup; + } =20 if (virBufferUse(&childBuf)) { virBufferAddLit(buf, ">\n"); @@ -24123,7 +24128,12 @@ virDomainSmartcardDefFormat(virBufferPtr buf, } else { virBufferAddLit(buf, "/>\n"); } - return 0; + + ret =3D 0; + + cleanup: + virBufferFreeAndReset(&childBuf); + return ret; } =20 static int @@ -24425,7 +24435,8 @@ virDomainRNGDefFormat(virBufferPtr buf, return -1; virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - virDomainChrSourceDefFormat(buf, def->source.chardev, flags); + if (virDomainChrSourceDefFormat(buf, def->source.chardev, flags) <= 0) + return -1; virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); =20 @@ -25270,7 +25281,10 @@ virDomainRedirdevDefFormat(virBufferPtr buf, return -1; virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - virDomainChrSourceDefFormat(buf, def->source, flags); + + if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0) + return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT); virBufferAdjustIndent(buf, -2); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869731986204.40677415499545; Tue, 28 Nov 2017 03:48:51 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1443D4ACCA; Tue, 28 Nov 2017 11:48:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E432F60479; Tue, 28 Nov 2017 11:48:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AD6A03D381; Tue, 28 Nov 2017 11:48:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmel8008720 for ; Tue, 28 Nov 2017 06:48:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id DB2B460176; Tue, 28 Nov 2017 11:48:40 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBF59600D1 for ; Tue, 28 Nov 2017 11:48:39 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:52 +0100 Message-Id: <20171128114813.28509-10-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 09/30] conf: Improve virDomainChrTargetDefFormat() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:48:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Make the switch statement type-aware, avoid calling virDomainChrTargetTypeToString() more than once and check its return value before using it. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4bae0cc94..72d5f289c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23954,7 +23954,7 @@ virDomainChrTargetDefFormat(virBufferPtr buf, const char *targetType =3D virDomainChrTargetTypeToString(def->deviceT= ype, def->targetTyp= e); =20 - switch (def->deviceType) { + switch ((virDomainChrDeviceType) def->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: { if (!targetType) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -24001,28 +24001,43 @@ virDomainChrTargetDefFormat(virBufferPtr buf, } =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: + if (!targetType) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not format console target type")); + return -1; + } + virBufferAsprintf(buf, "\n", - virDomainChrTargetTypeToString(def->deviceType, - def->targetType), - def->target.port); + targetType, def->target.port); break; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: + if (!targetType) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not format serial target type")); + return -1; + } + if (def->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { virBufferAsprintf(buf, "\n", - virDomainChrTargetTypeToString(def->deviceTy= pe, - def->targetTy= pe), + targetType, def->target.port); break; } ATTRIBUTE_FALLTHROUGH; =20 - default: + case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: virBufferAsprintf(buf, "\n", def->target.port); break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected char device type %d"), + def->deviceType); + return -1; } =20 return 0; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869736801833.4126655573319; Tue, 28 Nov 2017 03:48:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81B855D9EC; Tue, 28 Nov 2017 11:48:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A3E56062D; Tue, 28 Nov 2017 11:48:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 18A821802124; Tue, 28 Nov 2017 11:48:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmgXj008727 for ; Tue, 28 Nov 2017 06:48:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 69E7F60479; Tue, 28 Nov 2017 11:48:42 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AB10600D1 for ; Tue, 28 Nov 2017 11:48:41 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:53 +0100 Message-Id: <20171128114813.28509-11-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 10/30] conf: Remove ATTRIBUTE_FALLTHROUGH from virDomainChrTargetDefFormat() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 28 Nov 2017 11:48:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Formatting the element for serial devices will become a bit more complicated later on, and leaving the fallthrough behavior there would do nothing but complicate it further. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 72d5f289c..42e7596ac 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24019,14 +24019,18 @@ virDomainChrTargetDefFormat(virBufferPtr buf, return -1; } =20 + virBufferAddLit(buf, "targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { virBufferAsprintf(buf, - "\n", - targetType, - def->target.port); - break; + "type=3D'%s' ", + targetType); } - ATTRIBUTE_FALLTHROUGH; + + virBufferAsprintf(buf, + "port=3D'%d'/>\n", + def->target.port); + break; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: virBufferAsprintf(buf, "\n", --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869732633835.0309140516534; Tue, 28 Nov 2017 03:48:52 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92C61461D3; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 629AA5EDE8; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 24C721800FC5; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmhRN008735 for ; Tue, 28 Nov 2017 06:48:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC77A60479; Tue, 28 Nov 2017 11:48:43 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 092FF60176 for ; Tue, 28 Nov 2017 11:48:42 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:54 +0100 Message-Id: <20171128114813.28509-12-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 11/30] qemu: Introduce qemuDomainChrTargetDefValidate() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Nov 2017 11:48:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of waiting until we get to command line generation, we can validate the target for a char device much earlier. Move all the checks out of qemuBuildSerialChrDeviceStr() and into the new fuction. This will later allow us to validate the target for platform devices. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 20 ---------------- src/qemu/qemu_domain.c | 62 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 62 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 81c652cc3..0a4684231 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10382,22 +10382,9 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, _("usb-serial is not supported in this QEMU= binary")); goto error; } - - if (serial->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE= && - serial->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("usb-serial requires address of usb type"= )); - goto error; - } break; =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: - if (serial->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE= && - serial->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("isa-serial requires address of isa type"= )); - goto error; - } break; =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: @@ -10406,13 +10393,6 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, _("pci-serial is not supported with this QE= MU binary")); goto error; } - - if (serial->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE= && - serial->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("pci-serial requires address of pci type"= )); - goto error; - } break; =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 20e862a7b..0a04d9a24 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3460,6 +3460,65 @@ qemuDomainChrSourceDefValidate(const virDomainChrSou= rceDef *def) } =20 =20 +static int +qemuDomainChrTargetDefValidate(const virDomainDef *def, + const virDomainChrDef *chr) +{ + switch ((virDomainChrDeviceType) chr->deviceType) { + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: + + /* Validate target type */ + switch ((virDomainChrSerialTargetType) chr->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + /* Hack required until we have a proper type for pSeries + * serial consoles */ + if (qemuDomainIsPSeries(def)) + return 0; + + if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("isa-serial requires address of isa type"= )); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("usb-serial requires address of usb type"= )); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("pci-serial requires address of pci type"= )); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + break; + } + break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: + case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: + case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: + case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: + /* Nothing to do */ + break; + } + + return 0; +} + + static int qemuDomainChrDefValidate(const virDomainChrDef *dev, const virDomainDef *def) @@ -3467,6 +3526,9 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, if (qemuDomainChrSourceDefValidate(dev->source) < 0) return -1; =20 + if (qemuDomainChrTargetDefValidate(def, dev) < 0) + return -1; + if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL && (ARCH_IS_S390(def->os.arch) || qemuDomainIsPSeries(def))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869738636343.1885531928764; Tue, 28 Nov 2017 03:48:58 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 807576868A; Tue, 28 Nov 2017 11:48:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C67260BE5; Tue, 28 Nov 2017 11:48:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 293DE3D389; Tue, 28 Nov 2017 11:48:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmkfj008753 for ; Tue, 28 Nov 2017 06:48:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A0D360176; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A788360317 for ; Tue, 28 Nov 2017 11:48:44 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:55 +0100 Message-Id: <20171128114813.28509-13-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 12/30] qemu: Improve qemuDomainChrTargetDefValidate() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Nov 2017 11:48:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of validating each target type / address type combination separately, create a small helper to perform the matching and collapse all existing checks into a single one. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_domain.c | 50 ++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0a04d9a24..a719d14fe 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3460,43 +3460,53 @@ qemuDomainChrSourceDefValidate(const virDomainChrSo= urceDef *def) } =20 =20 +static int +qemuDomainChrSerialTargetTypeToAddressType(int targetType) +{ + switch ((virDomainChrSerialTargetType) targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + break; + } + + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; +} + + static int qemuDomainChrTargetDefValidate(const virDomainDef *def, const virDomainChrDef *chr) { + int expected; + switch ((virDomainChrDeviceType) chr->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: =20 /* Validate target type */ switch ((virDomainChrSerialTargetType) chr->targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + /* Hack required until we have a proper type for pSeries * serial consoles */ if (qemuDomainIsPSeries(def)) return 0; =20 - if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("isa-serial requires address of isa type"= )); - return -1; - } - break; - - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: - if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("usb-serial requires address of usb type"= )); - return -1; - } - break; + expected =3D qemuDomainChrSerialTargetTypeToAddressType(chr->t= argetType); =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("pci-serial requires address of pci type"= )); + chr->info.type !=3D expected) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target type '%s' requires address type '= %s'"), + virDomainChrSerialTargetTypeToString(chr->t= argetType), + virDomainDeviceAddressTypeToString(expected= )); return -1; } break; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869735792960.5547336005659; Tue, 28 Nov 2017 03:48:55 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C26E5883C9; Tue, 28 Nov 2017 11:48:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83F5F5D973; Tue, 28 Nov 2017 11:48:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 42B8E1802121; Tue, 28 Nov 2017 11:48:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmmuK008758 for ; Tue, 28 Nov 2017 06:48:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2919D60176; Tue, 28 Nov 2017 11:48:48 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39CE960462 for ; Tue, 28 Nov 2017 11:48:46 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:56 +0100 Message-Id: <20171128114813.28509-14-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 13/30] conf: Parse and format virDomainChrSerialTargetModel X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 28 Nov 2017 11:48:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This information will be used to select, and store in the guest configuration in order to guarantee ABI stability, the concrete (hypervisor-specific) model for serial devices. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- docs/formatdomain.html.in | 16 ++++++++-- docs/schemas/domaincommon.rng | 15 +++++++++ src/conf/domain_conf.c | 72 +++++++++++++++++++++++++++++++++++++++= +++- src/conf/domain_conf.h | 12 ++++++++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 84cfe35a9..0a7b0e20e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6531,7 +6531,9 @@ qemu-kvm -net nic,model=3D? /dev/null <devices> <!-- USB serial port --> <serial type=3D'pty'> - <target type=3D'usb-serial' port=3D'0'/> + <target type=3D'usb-serial' port=3D'0'> + <model name=3D'usb-serial'/> + </target> <address type=3D'usb' bus=3D'0' port=3D'1'/> </serial> </devices> @@ -6547,6 +6549,16 @@ qemu-kvm -net nic,model=3D? /dev/null is available).

=20 +

+ Since 3.10.0, the target + element can have an optional model subelement; + valid values for its name attribute are: + isa-serial (usable with the isa-serial tar= get + type); usb-serial (usable with the usb-serial + target type); pci-serial + (usable with the pci-serial target type). +

+

If any of the attributes is not specified by the user, libvirt will choose a value suitable for most users. @@ -6573,7 +6585,7 @@ qemu-kvm -net nic,model=3D? /dev/null <!-- Serial console --> <console type=3D'pty'> <source path=3D'/dev/pts/2'/> - <target type=3D'serial' port=3D'0'/> + <target type=3D'serial' port=3D'0'/> </console> </devices> ... diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f1808065b..fbba092d1 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3589,6 +3589,18 @@ =20 + + + + + isa-serial + usb-serial + pci-serial + + + + + @@ -3603,6 +3615,9 @@ + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 42e7596ac..5df5f3aae 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -472,6 +472,14 @@ VIR_ENUM_IMPL(virDomainChrConsoleTarget, "sclp", "sclplm") =20 +VIR_ENUM_IMPL(virDomainChrSerialTargetModel, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST, + "none", + "isa-serial", + "usb-serial", + "pci-serial", +); + VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, "parallel", "serial", @@ -11538,14 +11546,42 @@ virDomainChrTargetTypeFromString(int devtype, return ret; } =20 +static int +virDomainChrTargetModelFromString(int devtype, + const char *targetModel) +{ + int ret =3D -1; + + if (!targetModel) + return 0; + + switch ((virDomainChrDeviceType) devtype) { + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: + ret =3D virDomainChrSerialTargetModelTypeFromString(targetModel); + break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: + case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: + case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: + case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: + /* Target model not supported yet */ + ret =3D 0; + break; + } + + return ret; +} + static int virDomainChrDefParseTargetXML(virDomainChrDefPtr def, xmlNodePtr cur, unsigned int flags) { int ret =3D -1; + xmlNodePtr child; unsigned int port; char *targetType =3D virXMLPropString(cur, "type"); + char *targetModel =3D NULL; char *addrStr =3D NULL; char *portStr =3D NULL; char *stateStr =3D NULL; @@ -11559,6 +11595,24 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr d= ef, goto error; } =20 + child =3D cur->children; + while (child !=3D NULL) { + if (child->type =3D=3D XML_ELEMENT_NODE && + virXMLNodeNameEqual(child, "model")) { + targetModel =3D virXMLPropString(child, "name"); + } + child =3D child->next; + } + + if ((def->targetModel =3D + virDomainChrTargetModelFromString(def->deviceType, + targetModel)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown target model '%s' specified for characte= r device"), + targetModel); + goto error; + } + switch (def->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: switch (def->targetType) { @@ -11647,6 +11701,7 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr de= f, ret =3D 0; error: VIR_FREE(targetType); + VIR_FREE(targetModel); VIR_FREE(addrStr); VIR_FREE(portStr); VIR_FREE(stateStr); @@ -24028,8 +24083,23 @@ virDomainChrTargetDefFormat(virBufferPtr buf, } =20 virBufferAsprintf(buf, - "port=3D'%d'/>\n", + "port=3D'%d'", def->target.port); + + if (def->targetModel !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE)= { + virBufferAddLit(buf, ">\n"); + + virBufferAdjustIndent(buf, 2); + virBufferAsprintf(buf, + "\n", + virDomainChrSerialTargetModelTypeToString(de= f->targetModel)); + virBufferAdjustIndent(buf, -2); + + virBufferAddLit(buf, "\n"); + } else { + virBufferAddLit(buf, "/>\n"); + } + break; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ac6c4a0ed..7895dea55 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1108,6 +1108,17 @@ typedef enum { VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST } virDomainChrConsoleTargetType; =20 +typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE =3D 0, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, + + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST +} virDomainChrSerialTargetModel; + +VIR_ENUM_DECL(virDomainChrSerialTargetModel); + typedef enum { VIR_DOMAIN_CHR_TYPE_NULL, VIR_DOMAIN_CHR_TYPE_VC, @@ -1206,6 +1217,7 @@ struct _virDomainChrDef { int targetType; /* enum virDomainChrConsoleTargetType || enum virDomainChrChannelTargetType || enum virDomainChrSerialTargetType according to devi= ceType */ + int targetModel; /* enum virDomainChrSerialTargetModel */ =20 union { int port; /* parallel, serial, console */ --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869741687984.4510035475363; Tue, 28 Nov 2017 03:49:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A69744900B; Tue, 28 Nov 2017 11:49:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8374960600; Tue, 28 Nov 2017 11:49:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3BFBC1802126; Tue, 28 Nov 2017 11:49:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmoOB008772 for ; Tue, 28 Nov 2017 06:48:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8036D5B812; Tue, 28 Nov 2017 11:48:50 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED48960479 for ; Tue, 28 Nov 2017 11:48:48 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:57 +0100 Message-Id: <20171128114813.28509-15-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 14/30] qemu: Set targetModel based on targetType for serial devices X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:49:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_domain.c | 20 ++++++++++++++++= ++++ .../qemuargv2xmldata/qemuargv2xml-console-compat.xml | 4 +++- tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml | 4 +++- tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml | 4 +++- tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml | 8 ++++++-- tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml | 4 +++- .../qemuargv2xml-serial-tcp-telnet.xml | 4 +++- tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml | 4 +++- tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml | 8 ++++++-- tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml | 4 +++- tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml | 4 +++- ...uhotplug-console-compat-2-live+console-virtio.xml | 12 +++++++++--- .../qemuhotplug-console-compat-2-live.xml | 12 +++++++++--- ...qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml | 8 ++++++-- tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 8 ++++++-- .../qemuxml2xmlout-aarch64-pci-serial.xml | 4 +++- .../qemuxml2xmlout-bios-nvram-os-interleave.xml | 4 +++- .../qemuxml2xmlout-chardev-label.xml | 8 ++++++-- .../qemuxml2xmlout-console-compat-auto.xml | 4 +++- .../qemuxml2xmlout-console-compat.xml | 4 +++- .../qemuxml2xmlout-console-compat2.xml | 4 +++- .../qemuxml2xmlout-console-virtio-many.xml | 4 +++- .../qemuxml2xmlout-interface-driver.xml | 4 +++- .../qemuxml2xmlout-interface-server.xml | 8 ++++++-- .../qemuxml2xmlout-net-bandwidth.xml | 4 +++- .../qemuxml2xmlout-net-bandwidth2.xml | 4 +++- .../qemuxml2xmlout-net-coalesce.xml | 4 +++- tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml | 4 +++- .../qemuxml2xmlout-panic-pseries.xml | 4 +++- .../qemuxml2xmlout-pci-serial-dev-chardev.xml | 4 +++- .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 4 +++- .../qemuxml2xmlout-pseries-cpu-compat.xml | 4 +++- .../qemuxml2xmlout-pseries-cpu-exact.xml | 4 +++- .../qemuxml2xmlout-pseries-panic-missing.xml | 4 +++- .../qemuxml2xmlout-pseries-panic-no-address.xml | 4 +++- .../qemuxml2xmlout-q35-virt-manager-basic.xml | 4 +++- .../qemuxml2xmlout-serial-spiceport-nospice.xml | 4 +++- .../qemuxml2xmlout-serial-spiceport.xml | 4 +++- .../qemuxml2xmlout-serial-target-port-auto.xml | 12 +++++++++--- .../qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml | 8 ++++++-- .../qemuxml2xmlout-tap-vhost-incorrect.xml | 4 +++- .../qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml | 4 +++- .../qemuxml2xmlout-vhost_queues.xml | 4 +++- 43 files changed, 185 insertions(+), 55 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a719d14fe..e141e1132 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4192,6 +4192,26 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, } } =20 + /* Set the default target model */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE) { + switch ((virDomainChrSerialTargetType) chr->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SE= RIAL; + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SE= RIAL; + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SE= RIAL; + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Nothing to do */ + break; + } + } + /* clear auto generated unix socket path for inactive definitions */ if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) diff --git a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml b/tests= /qemuargv2xmldata/qemuargv2xml-console-compat.xml index 7c106f145..cba43ca45 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml @@ -28,7 +28,9 @@

- + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-dev.xml index e76d0211d..e9998d554 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml @@ -29,7 +29,9 @@ - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-file.xml index ed67ada0d..0e9dfe578 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml @@ -29,7 +29,9 @@ - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-many.xml index 420771dc9..05374b38d 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml @@ -28,11 +28,15 @@
- + + + - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-pty.xml index 7c106f145..cba43ca45 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml @@ -28,7 +28,9 @@
- + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml b/te= sts/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml index 3fe61ffa0..1ac12440e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml @@ -30,7 +30,9 @@ - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-tcp.xml index 3fc9fd39b..c10cee903 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml @@ -30,7 +30,9 @@ - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-udp.xml index 5b4af3fe9..fd56dda84 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml @@ -30,11 +30,15 @@ - + + + - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-unix.xml index 6bb291ff7..70b192f67 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml @@ -29,7 +29,9 @@ - + + + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml b/tests/qemu= argv2xmldata/qemuargv2xml-serial-vc.xml index 41954fc85..630844ea0 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml @@ -28,7 +28,9 @@
- + + + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live= +console-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-comp= at-2-live+console-virtio.xml index 427f431cc..abe68a0a0 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+consol= e-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+consol= e-virtio.xml @@ -68,17 +68,23 @@
- + + + - + + + - + + + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live= .xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml index 144f6eff7..45161e1e2 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml @@ -68,17 +68,23 @@
- + + + - + + + - + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev= -notls.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev= -notls.xml index e6c4adb6f..89dc9e6e1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.= xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.= xml @@ -29,12 +29,16 @@ - + + + - + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml b/tests/q= emuxml2argvdata/qemuxml2argv-user-aliases.xml index f9724d320..52132a82d 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml @@ -110,10 +110,14 @@
- + + + - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml index fddab31f0..b02a5a7db 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml @@ -34,7 +34,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interlea= ve.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.x= ml index 5ee73b527..b6d7a6636 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml @@ -33,7 +33,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml index ad77f62d9..7d5bbdd0a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml @@ -25,13 +25,17 @@ - + + + - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml index cd9d75c4b..267b253b1 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml @@ -27,7 +27,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml b/t= ests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml index 0c0bd7b34..6a52800a3 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml @@ -28,7 +28,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml b/= tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml index 305c53eab..8c7bbb768 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml @@ -31,7 +31,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml index b38b3ce98..1a22b78b8 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml @@ -30,7 +30,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml b= /tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml index 06192fbb4..5be590e75 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml @@ -47,7 +47,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b= /tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml index a6eaa3807..049b1472a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml @@ -104,10 +104,14 @@
- + + + - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml index e6ad23424..4ec77d154 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml @@ -55,7 +55,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/t= ests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml index 66448ec3d..ee65c3a5b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml @@ -44,7 +44,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml b/tes= ts/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml index b1240b8ed..56792b999 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml @@ -57,7 +57,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml b/tests/qe= muxml2xmloutdata/qemuxml2xmlout-net-mtu.xml index 4f7ad323e..fc7b2e39a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml @@ -54,7 +54,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml index a563b6ddd..496df0696 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml @@ -22,7 +22,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev= .xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml index 2f704cc0a..8f77ef043 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml @@ -28,7 +28,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-pow= er9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9= .xml index 59587b3c3..9d4c5efe6 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml @@ -25,7 +25,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml index a39e1fd01..6059859ab 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml @@ -25,7 +25,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml = b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml index 666eede1a..f3216523e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml @@ -26,7 +26,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.= xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml index a563b6ddd..496df0696 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml @@ -22,7 +22,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-addre= ss.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.x= ml index a563b6ddd..496df0696 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml @@ -22,7 +22,9 @@ - + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic= .xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml index 27baaa3f1..2437fdec4 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml @@ -79,7 +79,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospi= ce.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.x= ml index 63462e6f9..e1d5cb9d7 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml @@ -28,7 +28,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b= /tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml index c90bbeb7d..ff92435af 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml @@ -28,7 +28,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-aut= o.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml index a8790b509..fded758ea 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml @@ -27,13 +27,19 @@ - + + + - + + + - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-cha= rdev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chard= ev.xml index a8af87b53..76d894820 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml @@ -29,12 +29,16 @@ - + + + - + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml index f439f57ea..c4334f6ca 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -42,7 +42,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/= qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml index a2a6e5b3c..8e761762f 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml @@ -48,7 +48,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml b/tes= ts/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml index 72cbcc4cb..49a7b550b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml @@ -46,7 +46,9 @@
- + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869744642775.5018723294186; Tue, 28 Nov 2017 03:49:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC11268693; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 976C55C549; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 61E363D38C; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmqfw008785 for ; Tue, 28 Nov 2017 06:48:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id BD98860462; Tue, 28 Nov 2017 11:48:52 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE99E600D1 for ; Tue, 28 Nov 2017 11:48:50 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:58 +0100 Message-Id: <20171128114813.28509-16-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 15/30] qemu: Validate target model for serial devices X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Nov 2017 11:49:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Target model and target type must agree for the configuration to make sense, so check that's actually the case and error out otherwise. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/libvirt_private.syms | 2 ++ src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 875e474b6..290198ddd 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -209,6 +209,8 @@ virDomainChrGetDomainPtrs; virDomainChrInsertPreAlloced; virDomainChrPreAlloc; virDomainChrRemove; +virDomainChrSerialTargetModelTypeFromString; +virDomainChrSerialTargetModelTypeToString; virDomainChrSerialTargetTypeFromString; virDomainChrSerialTargetTypeToString; virDomainChrSourceDefClear; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e141e1132..0b033f496 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3479,6 +3479,25 @@ qemuDomainChrSerialTargetTypeToAddressType(int targe= tType) } =20 =20 +static int +qemuDomainChrSerialTargetModelToTargetType(int targetModel) +{ + switch ((virDomainChrSerialTargetModel) targetModel) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; + } + + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; +} + + static int qemuDomainChrTargetDefValidate(const virDomainDef *def, const virDomainChrDef *chr) @@ -3515,6 +3534,28 @@ qemuDomainChrTargetDefValidate(const virDomainDef *d= ef, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: break; } + + /* Validate target model */ + switch ((virDomainChrSerialTargetModel) chr->targetModel) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + + expected =3D qemuDomainChrSerialTargetModelToTargetType(chr->t= argetModel); + + if (chr->targetType !=3D expected) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires target type '= %s'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel), + virDomainChrSerialTargetTypeToString(expect= ed)); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; + } break; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869737113723.0495328591425; Tue, 28 Nov 2017 03:48:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2561C5AFED; Tue, 28 Nov 2017 11:48:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFA385EDE2; Tue, 28 Nov 2017 11:48:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BB7233D386; Tue, 28 Nov 2017 11:48:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmtYr008797 for ; Tue, 28 Nov 2017 06:48:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 22CFF600D1; Tue, 28 Nov 2017 11:48:55 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CD8060479 for ; Tue, 28 Nov 2017 11:48:53 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:47:59 +0100 Message-Id: <20171128114813.28509-17-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 16/30] qemu: Format targetModel for serial devices X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 28 Nov 2017 11:48:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that we've created a distinction between target type and target model, with the latter being the concrete device name, it's time to switch to formatting the model instead of the type. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0a4684231..718dfb15f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10375,8 +10375,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, serial->info.alias); } } else { - switch ((virDomainChrSerialTargetType) serial->targetType) { - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + switch ((virDomainChrSerialTargetModel) serial->targetModel) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("usb-serial is not supported in this QEMU= binary")); @@ -10384,10 +10384,10 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: break; =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("pci-serial is not supported with this QE= MU binary")); @@ -10395,19 +10395,19 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: /* Except from _LAST, which is just a guard value and will nev= er * be used, all of the above are platform devices, which means * qemuBuildSerialCommandLine() will have taken the appropriate * branch and we will not have ended up here. */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid target type for serial device")); + _("Invalid target model for serial device")); goto error; } =20 virBufferAsprintf(&cmd, "%s,chardev=3Dchar%s,id=3D%s", - virDomainChrSerialTargetTypeToString(serial->tar= getType), + virDomainChrSerialTargetModelTypeToString(serial= ->targetModel), serial->info.alias, serial->info.alias); } =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869741898246.84710453920593; Tue, 28 Nov 2017 03:49:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E325913A5D; Tue, 28 Nov 2017 11:49:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDBF360605; Tue, 28 Nov 2017 11:49:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6C4F8180212A; Tue, 28 Nov 2017 11:49:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBmxSZ008808 for ; Tue, 28 Nov 2017 06:48:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6963A60175; Tue, 28 Nov 2017 11:48:59 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7376D60479 for ; Tue, 28 Nov 2017 11:48:55 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:00 +0100 Message-Id: <20171128114813.28509-18-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 17/30] qemu: Remove redundancy in qemuBuildSerialChrDeviceStr() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Nov 2017 11:49:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead duplicating the capability check for each possible target model, introduce a small helper that matches the target model with the corresponding capability and collapse all existing checks into a single one. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 718dfb15f..8249c6237 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9222,6 +9222,25 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManage= r, return 0; } =20 + +static virQEMUCapsFlags +qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel) +{ + switch (targetModel) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + return QEMU_CAPS_DEVICE_USB_SERIAL; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + return QEMU_CAPS_DEVICE_PCI_SERIAL; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; + } + + return 0; +} + + static int qemuBuildChrDeviceCommandLine(virCommandPtr cmd, const virDomainDef *def, @@ -10351,6 +10370,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, return NULL; } =20 + /* This function generates the correct '-device' string for character * devices of each architecture. */ @@ -10361,6 +10381,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, virQEMUCapsPtr qemuCaps) { virBuffer cmd =3D VIR_BUFFER_INITIALIZER; + virQEMUCapsFlags caps; =20 if (qemuDomainIsPSeries(def)) { if (serial->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && @@ -10377,9 +10398,14 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } else { switch ((virDomainChrSerialTargetModel) serial->targetModel) { case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("usb-serial is not supported in this QEMU= binary")); + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + + caps =3D qemuChrSerialTargetModelToCaps(serial->targetModel); + + if (caps && !virQEMUCapsGet(qemuCaps, caps)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("'%s' is not supported in this QEMU binar= y"), + virDomainChrSerialTargetModelTypeToString(s= erial->targetModel)); goto error; } break; @@ -10387,14 +10413,6 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: break; =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("pci-serial is not supported with this QE= MU binary")); - goto error; - } - break; - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: /* Except from _LAST, which is just a guard value and will nev= er --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869744852288.552072282725; Tue, 28 Nov 2017 03:49:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D441F82109; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B2F7160175; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8005F3D381; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBn1Y4008819 for ; Tue, 28 Nov 2017 06:49:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8FF20600D1; Tue, 28 Nov 2017 11:49:01 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0985060462 for ; Tue, 28 Nov 2017 11:48:59 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:01 +0100 Message-Id: <20171128114813.28509-19-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 18/30] conf: Add target type and model for spapr-vty X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 28 Nov 2017 11:49:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We can finally introduce a specific target model for the spapr-vty device used by pSeries guests, which means isa-serial will no longer show up to confuse users. We make sure migration works in both directions by interpreting the isa-serial target type, or the lack of target type, appropriately when parsing the guest XML, and skipping the newly-introduced type when formatting if for migration. We also verify that spapr-vty is not used for non-pSeries guests and add a bunch of test cases. This commit is best viewed with 'git show -w'. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1511421 Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- docs/formatdomain.html.in | 13 ++-- docs/schemas/domaincommon.rng | 2 + src/conf/domain_conf.c | 6 +- src/conf/domain_conf.h | 2 + src/qemu/qemu_command.c | 67 +++++++++---------= --- src/qemu/qemu_domain.c | 69 ++++++++++++++++++= ---- src/qemu/qemu_domain_address.c | 1 + .../qemuxml2argv-pseries-basic.args | 2 +- .../qemuxml2argv-pseries-console-native.args | 1 + .../qemuxml2argv-pseries-console-native.xml | 17 ++++++ ...gs =3D> qemuxml2argv-pseries-console-virtio.args} | 10 ++-- .../qemuxml2argv-pseries-console-virtio.xml | 19 ++++++ .../qemuxml2argv-pseries-cpu-compat-power9.args | 2 +- .../qemuxml2argv-pseries-cpu-compat.args | 2 +- .../qemuxml2argv-pseries-cpu-exact.args | 2 +- .../qemuxml2argv-pseries-cpu-le.args | 2 +- .../qemuxml2argv-pseries-panic-missing.args | 2 +- .../qemuxml2argv-pseries-panic-no-address.args | 2 +- ...qemuxml2argv-pseries-serial+console-native.args | 1 + .../qemuxml2argv-pseries-serial+console-native.xml | 18 ++++++ .../qemuxml2argv-pseries-serial-compat.args | 1 + .../qemuxml2argv-pseries-serial-compat.xml | 19 ++++++ ...qemuxml2argv-pseries-serial-invalid-machine.xml | 19 ++++++ ...rgs =3D> qemuxml2argv-pseries-serial-native.args} | 7 +-- .../qemuxml2argv-pseries-serial-native.xml | 16 +++++ .../qemuxml2argv-pseries-usb-default.args | 2 +- .../qemuxml2argv-pseries-usb-kbd.args | 2 +- .../qemuxml2argv-pseries-usb-multi.args | 2 +- .../qemuxml2argv-pseries-vio-user-assigned.args | 4 +- .../qemuxml2argvdata/qemuxml2argv-pseries-vio.args | 4 +- tests/qemuxml2argvtest.c | 16 +++++ .../qemuxml2xmlout-panic-pseries.xml | 4 +- .../qemuxml2xmlout-pseries-console-native.xml | 1 + ...l =3D> qemuxml2xmlout-pseries-console-virtio.xml} | 18 ++---- .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 4 +- .../qemuxml2xmlout-pseries-cpu-compat.xml | 4 +- .../qemuxml2xmlout-pseries-cpu-exact.xml | 4 +- .../qemuxml2xmlout-pseries-panic-missing.xml | 4 +- .../qemuxml2xmlout-pseries-panic-no-address.xml | 4 +- ...emuxml2xmlout-pseries-serial+console-native.xml | 1 + .../qemuxml2xmlout-pseries-serial-compat.xml | 1 + ...ml =3D> qemuxml2xmlout-pseries-serial-native.xml} | 10 ++-- tests/qemuxml2xmltest.c | 15 +++++ 43 files changed, 293 insertions(+), 109 deletions(-) create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-nat= ive.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-nat= ive.xml copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args =3D> qemuxml2= argv-pseries-console-virtio.args} (59%) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-vir= tio.xml create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+cons= ole-native.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+cons= ole-native.xml create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-comp= at.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-comp= at.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-inva= lid-machine.xml copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args =3D> qemuxml2= argv-pseries-serial-native.args} (70%) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-nati= ve.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console= -native.xml copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-panic-pseries.xml =3D> qemux= ml2xmlout-pseries-console-virtio.xml} (71%) create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+= console-native.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-= compat.xml copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-panic-pseries.xml =3D> qemux= ml2xmlout-pseries-serial-native.xml} (79%) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0a7b0e20e..e9c53da96 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6546,7 +6546,9 @@ qemu-kvm -net nic,model=3D? /dev/null since 1.0.2, isa-serial (u= sable with x86 guests), usb-serial (usable whenever USB suppo= rt is available) and pci-serial (usable whenever PCI suppo= rt - is available). + is available); since 3.10.0, + spapr-vio-serial (usable with ppc64/pseries guests) + is available as well.

=20

@@ -6556,7 +6558,9 @@ qemu-kvm -net nic,model=3D? /dev/null isa-serial (usable with the isa-serial tar= get type); usb-serial (usable with the usb-serial target type); pci-serial - (usable with the pci-serial target type). + (usable with the pci-serial target type); + spapr-vty (usable with the spapr-vio-serial + target type).

=20

@@ -6568,8 +6572,9 @@ qemu-kvm -net nic,model=3D? /dev/null All of the target types support configuring the guest-visible device address as documented above; more specifically, acceptable address types are isa (for - isa-serial), usb (for usb-serial) - and pci (for pci-serial). + isa-serial), usb (for usb-serial), + pci (for pci-serial) and spapr-vio + (for spapr-vio-serial).

=20

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fbba092d1..1f6d25e1b 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3585,6 +3585,7 @@ isa-serial usb-serial pci-serial + spapr-vio-serial @@ -3596,6 +3597,7 @@ isa-serial usb-serial pci-serial + spapr-vty diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5df5f3aae..62d54560e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -451,7 +451,9 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "none", "isa-serial", "usb-serial", - "pci-serial") + "pci-serial", + "spapr-vio-serial", +); =20 VIR_ENUM_IMPL(virDomainChrChannelTarget, VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST, @@ -478,6 +480,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, "isa-serial", "usb-serial", "pci-serial", + "spapr-vty", ); =20 VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, @@ -4057,6 +4060,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) =20 switch ((virDomainChrSerialTargetType) def->serials[0]->targetType= ) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { =20 /* Create a stub console to match the serial port. diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7895dea55..35f5c63c2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1081,6 +1081,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST } virDomainChrSerialTargetType; @@ -1113,6 +1114,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST } virDomainChrSerialTargetModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8249c6237..fecf5ce5f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9231,6 +9231,8 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTarg= etModel targetModel) return QEMU_CAPS_DEVICE_USB_SERIAL; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: return QEMU_CAPS_DEVICE_PCI_SERIAL; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + return QEMU_CAPS_DEVICE_SPAPR_VTY; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: @@ -10383,52 +10385,39 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, virBuffer cmd =3D VIR_BUFFER_INITIALIZER; virQEMUCapsFlags caps; =20 - if (qemuDomainIsPSeries(def)) { - if (serial->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && - serial->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRV= IO) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spapr-vty not supported in this QEMU bin= ary")); - goto error; - } - - virBufferAsprintf(&cmd, "spapr-vty,chardev=3Dchar%s", - serial->info.alias); - } - } else { - switch ((virDomainChrSerialTargetModel) serial->targetModel) { - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: - - caps =3D qemuChrSerialTargetModelToCaps(serial->targetModel); - - if (caps && !virQEMUCapsGet(qemuCaps, caps)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("'%s' is not supported in this QEMU binar= y"), - virDomainChrSerialTargetModelTypeToString(s= erial->targetModel)); - goto error; - } - break; + switch ((virDomainChrSerialTargetModel) serial->targetModel) { + 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: =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: - break; + caps =3D qemuChrSerialTargetModelToCaps(serial->targetModel); =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: - /* Except from _LAST, which is just a guard value and will nev= er - * be used, all of the above are platform devices, which means - * qemuBuildSerialCommandLine() will have taken the appropriate - * branch and we will not have ended up here. */ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid target model for serial device")); + if (caps && !virQEMUCapsGet(qemuCaps, caps)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("'%s' is not supported in this QEMU binary"), + virDomainChrSerialTargetModelTypeToString(seria= l->targetModel)); goto error; } + break; =20 - virBufferAsprintf(&cmd, "%s,chardev=3Dchar%s,id=3D%s", - virDomainChrSerialTargetModelTypeToString(serial= ->targetModel), - serial->info.alias, serial->info.alias); + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + /* Except from _LAST, which is just a guard value and will never + * be used, all of the above are platform devices, which means + * qemuBuildSerialCommandLine() will have taken the appropriate + * branch and we will not have ended up here. */ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid target model for serial device")); + goto error; } =20 + virBufferAsprintf(&cmd, "%s,chardev=3Dchar%s,id=3D%s", + virDomainChrSerialTargetModelTypeToString(serial->ta= rgetModel), + serial->info.alias, serial->info.alias); + if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) < 0) goto error; =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0b033f496..d8ab6ed52 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3470,6 +3470,8 @@ qemuDomainChrSerialTargetTypeToAddressType(int target= Type) return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: break; @@ -3489,6 +3491,8 @@ qemuDomainChrSerialTargetModelToTargetType(int target= Model) return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -3499,8 +3503,7 @@ qemuDomainChrSerialTargetModelToTargetType(int target= Model) =20 =20 static int -qemuDomainChrTargetDefValidate(const virDomainDef *def, - const virDomainChrDef *chr) +qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) { int expected; =20 @@ -3512,11 +3515,7 @@ qemuDomainChrTargetDefValidate(const virDomainDef *d= ef, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: - - /* Hack required until we have a proper type for pSeries - * serial consoles */ - if (qemuDomainIsPSeries(def)) - return 0; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: =20 expected =3D qemuDomainChrSerialTargetTypeToAddressType(chr->t= argetType); =20 @@ -3540,6 +3539,7 @@ qemuDomainChrTargetDefValidate(const virDomainDef *de= f, case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: 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: =20 expected =3D qemuDomainChrSerialTargetModelToTargetType(chr->t= argetModel); =20 @@ -3577,7 +3577,7 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, if (qemuDomainChrSourceDefValidate(dev->source) < 0) return -1; =20 - if (qemuDomainChrTargetDefValidate(def, dev) < 0) + if (qemuDomainChrTargetDefValidate(dev) < 0) return -1; =20 if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL && @@ -3587,6 +3587,26 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, return -1; } =20 + if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { + bool isCompatible =3D true; + + if (!qemuDomainIsPSeries(def) && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAP= R_VIO || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SP= APR_VTY)) { + isCompatible =3D false; + } + + if (!isCompatible) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Serial device with target type '%s' and " + "target model '%s' not compatible with guest " + "architecture or machine type"), + virDomainChrSerialTargetTypeToString(dev->targe= tType), + virDomainChrSerialTargetModelTypeToString(dev->= targetModel)); + return -1; + } + } + return 0; } =20 @@ -4226,10 +4246,7 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, if (ARCH_IS_X86(def->os.arch)) { chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; } else if (qemuDomainIsPSeries(def)) { - /* Setting TYPE_ISA here is just a temporary hack to reduce te= st - * suite churn. Later on we will have a proper serial type for - * pSeries and this line will be updated accordingly. */ - chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VI= O; } } =20 @@ -4246,6 +4263,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SE= RIAL; break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_= VTY; + break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: /* Nothing to do */ @@ -5151,6 +5171,31 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driv= er, goto cleanup; } =20 + for (i =3D 0; i < def->nserials; i++) { + virDomainChrDefPtr serial =3D def->serials[i]; + + /* Historically, the native console type for some machine types + * was not set at all, which means it defaulted to ISA even + * though that was not even remotely accurate. To ensure migra= tion + * towards older libvirt versions works for such guests, we sw= itch + * it back to the default here */ + if (flags & VIR_DOMAIN_XML_MIGRATABLE) { + switch ((virDomainChrSerialTargetType) serial->targetType)= { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + serial->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TY= PE_NONE; + serial->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_M= ODEL_NONE; + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Nothing to do */ + break; + } + } + } + /* Replace the CPU definition updated according to QEMU with the o= ne * used for starting the domain. The updated def will be sent * separately for backward compatibility. diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 989c0e6c9..2319e503e 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -782,6 +782,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: return 0; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args b/tests= /qemuxml2argvdata/qemuxml2argv-pseries-basic.args index 97a7057ba..789d9f679 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args @@ -20,4 +20,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.arg= s b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args new file mode 120000 index 000000000..d6c830ecd --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args @@ -0,0 +1 @@ +qemuxml2argv-pseries-serial-native.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml= b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml new file mode 100644 index 000000000..9f37bf0de --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml @@ -0,0 +1,17 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args b/tests= /qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args similarity index 59% copy from tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args copy to tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args index 97a7057ba..343018fb3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args @@ -5,7 +5,7 @@ USER=3Dtest \ LOGNAME=3Dtest \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-ppc64 \ --name QEMUGuest1 \ +-name guest \ -S \ -M pseries \ -m 512 \ @@ -14,10 +14,10 @@ QEMU_AUDIO_DRV=3Dnone \ -nographic \ -nodefconfig \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ -boot c \ --usb \ --chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device virtio-serial-pci,id=3Dvirtio-serial0,bus=3Dpci.0,addr=3D0x1 \ +-chardev pty,id=3Dcharconsole0 \ +-device virtconsole,chardev=3Dcharconsole0,id=3Dconsole0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml= b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml new file mode 100644 index 000000000..0190ab63a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml @@ -0,0 +1,19 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.= args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args index af93d63dc..9bb375aeb 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args @@ -21,4 +21,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args b/= tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args index 7740e2f5a..5174aa760 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args @@ -21,4 +21,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args b/t= ests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args index d2c99a7fa..3790deca8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args @@ -21,4 +21,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args b/test= s/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args index 97a7057ba..789d9f679 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args @@ -20,4 +20,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args= b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args index 97a7057ba..789d9f679 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args @@ -20,4 +20,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args index 97a7057ba..789d9f679 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args @@ -20,4 +20,4 @@ server,nowait \ -boot c \ -usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-nat= ive.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-nativ= e.args new file mode 120000 index 000000000..d6c830ecd --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.args @@ -0,0 +1 @@ +qemuxml2argv-pseries-serial-native.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-nat= ive.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native= .xml new file mode 100644 index 000000000..2733baa98 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.xml @@ -0,0 +1,18 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args= b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args new file mode 120000 index 000000000..d6c830ecd --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args @@ -0,0 +1 @@ +qemuxml2argv-pseries-serial-native.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml = b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml new file mode 100644 index 000000000..2e182edbd --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml @@ -0,0 +1,19 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-mac= hine.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machi= ne.xml new file mode 100644 index 000000000..5482146a5 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machine.xml @@ -0,0 +1,19 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args b/tests= /qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args similarity index 70% copy from tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args copy to tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args index 97a7057ba..f72b8b625 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args @@ -5,7 +5,7 @@ USER=3Dtest \ LOGNAME=3Dtest \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-ppc64 \ --name QEMUGuest1 \ +-name guest \ -S \ -M pseries \ -m 512 \ @@ -14,10 +14,9 @@ QEMU_AUDIO_DRV=3Dnone \ -nographic \ -nodefconfig \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ -boot c \ --usb \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml = b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml new file mode 100644 index 000000000..6cec4bc9d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml @@ -0,0 +1,16 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args b= /tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args index a92b1e01b..37c059403 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args @@ -20,4 +20,4 @@ server,nowait \ -boot c \ -device pci-ohci,id=3Dusb,bus=3Dpci.0,addr=3D0x1 \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args b/tes= ts/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args index caaccdbb8..838b80453 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args @@ -20,5 +20,5 @@ server,nowait \ -boot c \ -device pci-ohci,id=3Dusb,bus=3Dpci.0,addr=3D0x1 \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 \ +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 \ -device usb-kbd,id=3Dinput0,bus=3Dusb.0,port=3D1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args b/t= ests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args index b9bd905a5..56bc1d67e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args @@ -21,4 +21,4 @@ server,nowait \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1 \ -device pci-ohci,id=3Dusb1,bus=3Dpci.0,addr=3D0x2 \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.= args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args index 63cf3c183..0fcfbe379 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args @@ -25,6 +25,6 @@ server,nowait \ -device scsi-disk,bus=3Dscsi1.0,channel=3D0,scsi-id=3D0,lun=3D0,\ drive=3Ddrive-scsi1-0-0-0,id=3Dscsi1-0-0-0 \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x20000000 \ +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x20000000 \ -chardev pty,id=3Dcharserial1 \ --device spapr-vty,chardev=3Dcharserial1,reg=3D0x30001000 +-device spapr-vty,chardev=3Dcharserial1,id=3Dserial1,reg=3D0x30001000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args b/tests/q= emuxml2argvdata/qemuxml2argv-pseries-vio.args index 0294067bc..8a9bdcc4c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args @@ -25,6 +25,6 @@ server,nowait \ -device scsi-disk,bus=3Dscsi1.0,channel=3D0,scsi-id=3D0,lun=3D0,\ drive=3Ddrive-scsi1-0-0-0,id=3Dscsi1-0-0-0 \ -chardev pty,id=3Dcharserial0 \ --device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 \ +-device spapr-vty,chardev=3Dcharserial0,id=3Dserial0,reg=3D0x30000000 \ -chardev pty,id=3Dcharserial1 \ --device spapr-vty,chardev=3Dcharserial1,reg=3D0x30001000 +-device spapr-vty,chardev=3Dcharserial1,id=3Dserial1,reg=3D0x30001000 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 29df253b8..5827a47e5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1877,6 +1877,22 @@ mymain(void) QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); =20 + DO_TEST("pseries-serial-native", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-serial+console-native", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-serial-compat", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-console-native", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-console-virtio", + QEMU_CAPS_NODEFCONFIG); + DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); + DO_TEST("disk-ide-drive-split", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_IDE_CD); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml index 496df0696..484fe4cfa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml @@ -22,8 +22,8 @@ - - + +

diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native= .xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml new file mode 120000 index 000000000..b0e645fc0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml @@ -0,0 +1 @@ +qemuxml2xmlout-pseries-serial-native.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml similarity index 71% copy from tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml copy to tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml index 496df0696..48760f282 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml @@ -1,5 +1,5 @@ - QEMUGuest1 + guest 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 524288 524288 @@ -14,22 +14,16 @@ destroy /usr/bin/qemu-system-ppc64 - -
- + - - - - -
- + +
+ - -
+ diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-pow= er9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9= .xml index 9d4c5efe6..404bb0c76 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml @@ -25,8 +25,8 @@ - - + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml index 6059859ab..1891fa5f4 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml @@ -25,8 +25,8 @@ - - + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml = b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml index f3216523e..f08f3e005 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml @@ -26,8 +26,8 @@ - - + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.= xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml index 496df0696..484fe4cfa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml @@ -22,8 +22,8 @@ - - + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-addre= ss.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.x= ml index 496df0696..484fe4cfa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml @@ -22,8 +22,8 @@ - - + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console= -native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+consol= e-native.xml new file mode 120000 index 000000000..b0e645fc0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console-native= .xml @@ -0,0 +1 @@ +qemuxml2xmlout-pseries-serial-native.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.= xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml new file mode 120000 index 000000000..b0e645fc0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml @@ -0,0 +1 @@ +qemuxml2xmlout-pseries-serial-native.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml similarity index 79% copy from tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml copy to tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml index 496df0696..fae7c54d5 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml @@ -1,5 +1,5 @@ - QEMUGuest1 + guest 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 524288 524288 @@ -14,16 +14,14 @@ destroy /usr/bin/qemu-system-ppc64 - -
- + - - + +
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index d66cf155d..4318ae503 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -768,6 +768,21 @@ mymain(void) QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); =20 + DO_TEST("pseries-serial-native", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-serial+console-native", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-serial-compat", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-console-native", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-console-virtio", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("balloon-device-auto", NONE); DO_TEST("balloon-device-period", NONE); DO_TEST("channel-virtio-auto", NONE); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869748243364.829358257188; Tue, 28 Nov 2017 03:49:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 392E08047E; Tue, 28 Nov 2017 11:49:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F4505D972; Tue, 28 Nov 2017 11:49:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4C59B1800BD3; Tue, 28 Nov 2017 11:49:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBn370008827 for ; Tue, 28 Nov 2017 06:49:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 680DA60484; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FB73600D1 for ; Tue, 28 Nov 2017 11:49:01 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:02 +0100 Message-Id: <20171128114813.28509-20-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 19/30] qemu: Support usb-serial and pci-serial on pSeries X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 28 Nov 2017 11:49:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The existing implementation set the address type for all serial devices to spapr-vio, which made it impossible to use other devices such as usb-serial and pci-serial; moreover, some decisions were made based on the address type rather than the device type. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1512934 Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 9 ------ src/qemu/qemu_domain_address.c | 3 +- .../qemuxml2argv-pseries-serial-pci.args | 22 +++++++++++++++ .../qemuxml2argv-pseries-serial-pci.xml | 18 ++++++++++++ .../qemuxml2argv-pseries-serial-usb.args | 23 ++++++++++++++++ .../qemuxml2argv-pseries-serial-usb.xml | 21 ++++++++++++++ tests/qemuxml2argvtest.c | 7 +++++ .../qemuxml2xmlout-pseries-serial-pci.xml | 31 ++++++++++++++++++= +++ .../qemuxml2xmlout-pseries-serial-usb.xml | 32 ++++++++++++++++++= ++++ tests/qemuxml2xmltest.c | 7 +++++ 10 files changed, 163 insertions(+), 10 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.= xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.= xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-= pci.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-= usb.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fecf5ce5f..9a620dcdc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9264,15 +9264,6 @@ static bool qemuChrIsPlatformDevice(const virDomainDef *def, virDomainChrDefPtr chr) { - if ((def->os.arch =3D=3D VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch))= { - if (!qemuDomainIsPSeries(def)) - return true; - /* only pseries need -device spapr-vty with -chardev */ - if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && - chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) - return true; - } - if (def->os.arch =3D=3D VIR_ARCH_ARMV7L || def->os.arch =3D=3D VIR_ARC= H_AARCH64) { /* TARGET_TYPE_ISA here really means 'the default platform device'= */ if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 2319e503e..f62bb2f97 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -246,8 +246,9 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, =20 for (i =3D 0; i < def->nserials; i++) { if (def->serials[i]->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_= SERIAL && - qemuDomainIsPSeries(def)) + def->serials[i]->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGE= T_TYPE_SPAPR_VIO) { def->serials[i]->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_= SPAPRVIO; + } if (qemuDomainAssignSpaprVIOAddress(def, &def->serials[i]->info, VIO_ADDR_SERIAL) < 0) goto cleanup; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args b/= tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args new file mode 100644 index 000000000..eb2a9bf0e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args @@ -0,0 +1,22 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-M pseries \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-chardev pty,id=3Dcharserial0 \ +-device pci-serial,chardev=3Dcharserial0,id=3Dserial0,bus=3Dpci.0,addr=3D0= x1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml new file mode 100644 index 000000000..2c2534b4c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml @@ -0,0 +1,18 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args b/= tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args new file mode 100644 index 000000000..0403985dc --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args @@ -0,0 +1,23 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-M pseries \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-device qemu-xhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1 \ +-chardev pty,id=3Dcharserial0 \ +-device usb-serial,chardev=3Dcharserial0,id=3Dserial0,bus=3Dusb.0,port=3D1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml new file mode 100644 index 000000000..734c90c66 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml @@ -0,0 +1,21 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5827a47e5..0ba23d070 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1886,6 +1886,13 @@ mymain(void) DO_TEST("pseries-serial-compat", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-serial-pci", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_PCI_SERIAL); + DO_TEST("pseries-serial-usb", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_QEMU_XHCI, + QEMU_CAPS_DEVICE_USB_SERIAL); DO_TEST("pseries-console-native", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_VTY); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml new file mode 100644 index 000000000..cba7ea96b --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml @@ -0,0 +1,31 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + +
+ + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml new file mode 100644 index 000000000..34f651308 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml @@ -0,0 +1,32 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4318ae503..45cb739cd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -777,6 +777,13 @@ mymain(void) DO_TEST("pseries-serial-compat", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_VTY); + DO_TEST("pseries-serial-pci", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_PCI_SERIAL); + DO_TEST("pseries-serial-usb", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_QEMU_XHCI, + QEMU_CAPS_DEVICE_USB_SERIAL); DO_TEST("pseries-console-native", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_VTY); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869750065602.5986979006145; Tue, 28 Nov 2017 03:49:10 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0181525C44; Tue, 28 Nov 2017 11:49:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AAA315EDE6; Tue, 28 Nov 2017 11:49:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5F3921800FC6; Tue, 28 Nov 2017 11:49:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBn7wO008859 for ; Tue, 28 Nov 2017 06:49:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 06E7E60176; Tue, 28 Nov 2017 11:49:07 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FF3260462 for ; Tue, 28 Nov 2017 11:49:03 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:03 +0100 Message-Id: <20171128114813.28509-21-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 20/30] conf: Add target type and model for pl011 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 28 Nov 2017 11:49:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We can finally introduce a specific target model for the pl011 device used by mach-virt guests, which means isa-serial will no longer show up to confuse users. We make sure migration works in both directions by interpreting the isa-serial target type, or the lack of target type, appropriately when parsing the guest XML, and skipping the newly-introduced type when formatting if for migration. We also verify that pl011 is not used for non-mach-virt guests and add a bunch of test cases. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D151292 Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- docs/formatdomain.html.in | 13 ++++--- docs/schemas/domaincommon.rng | 2 + src/conf/domain_conf.c | 3 ++ src/conf/domain_conf.h | 2 + src/qemu/qemu_command.c | 9 ++++- src/qemu/qemu_domain.c | 26 +++++++++++++ src/qemu/qemu_domain_address.c | 1 + .../qemuxml2argv-mach-virt-console-native.args | 1 + .../qemuxml2argv-mach-virt-console-native.xml | 17 +++++++++ .../qemuxml2argv-mach-virt-console-virtio.args | 24 ++++++++++++ .../qemuxml2argv-mach-virt-console-virtio.xml | 19 ++++++++++ ...muxml2argv-mach-virt-serial+console-native.args | 1 + ...emuxml2argv-mach-virt-serial+console-native.xml | 18 +++++++++ .../qemuxml2argv-mach-virt-serial-compat.args | 1 + .../qemuxml2argv-mach-virt-serial-compat.xml | 19 ++++++++++ ...muxml2argv-mach-virt-serial-invalid-machine.xml | 21 +++++++++++ .../qemuxml2argv-mach-virt-serial-native.args | 23 +++++++++++ .../qemuxml2argv-mach-virt-serial-native.xml | 16 ++++++++ .../qemuxml2argv-mach-virt-serial-pci.args | 26 +++++++++++++ .../qemuxml2argv-mach-virt-serial-pci.xml | 18 +++++++++ .../qemuxml2argv-mach-virt-serial-usb.args | 27 +++++++++++++ .../qemuxml2argv-mach-virt-serial-usb.xml | 21 +++++++++++ tests/qemuxml2argvtest.c | 27 +++++++++++++ .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 4 +- .../qemuxml2xmlout-mach-virt-console-native.xml | 1 + .../qemuxml2xmlout-mach-virt-console-virtio.xml | 27 +++++++++++++ ...uxml2xmlout-mach-virt-serial+console-native.xml | 1 + .../qemuxml2xmlout-mach-virt-serial-compat.xml | 31 +++++++++++++++ .../qemuxml2xmlout-mach-virt-serial-native.xml | 1 + .../qemuxml2xmlout-mach-virt-serial-pci.xml | 44 ++++++++++++++++++= ++++ .../qemuxml2xmlout-mach-virt-serial-usb.xml | 41 ++++++++++++++++++= ++ tests/qemuxml2xmltest.c | 26 +++++++++++++ 32 files changed, 503 insertions(+), 8 deletions(-) create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-n= ative.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-n= ative.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-v= irtio.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-v= irtio.xml create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+co= nsole-native.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+co= nsole-native.xml create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-co= mpat.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-co= mpat.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-in= valid-machine.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-na= tive.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-na= tive.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pc= i.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pc= i.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-us= b.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-us= b.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-conso= le-native.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-conso= le-virtio.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-seria= l+console-native.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-seria= l-compat.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-seria= l-native.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-seria= l-pci.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-seria= l-usb.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index e9c53da96..8cccccc52 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6547,8 +6547,9 @@ qemu-kvm -net nic,model=3D? /dev/null with x86 guests), usb-serial (usable whenever USB suppo= rt is available) and pci-serial (usable whenever PCI suppo= rt is available); since 3.10.0, - spapr-vio-serial (usable with ppc64/pseries guests) - is available as well. + spapr-vio-serial (usable with ppc64/pseries guests) and + system-serial (usable with aarch64/virt guests) are + available as well.

=20

@@ -6560,7 +6561,8 @@ qemu-kvm -net nic,model=3D? /dev/null target type); pci-serial (usable with the pci-serial target type); spapr-vty (usable with the spapr-vio-serial - target type). + target type); pl011 (usable with the + system-serial target type).

=20

@@ -6569,12 +6571,13 @@ qemu-kvm -net nic,model=3D? /dev/null

=20

- All of the target types support configuring the guest-visible device + Most target types support configuring the guest-visible device address as documented above; more specifically, acceptable address types are isa (for isa-serial), usb (for usb-serial), pci (for pci-serial) and spapr-vio - (for spapr-vio-serial). + (for spapr-vio-serial). The system-serial + target type doesn't support specifying an address.

=20

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1f6d25e1b..5fff3a40f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3586,6 +3586,7 @@ usb-serial pci-serial spapr-vio-serial + system-serial @@ -3598,6 +3599,7 @@ usb-serial pci-serial spapr-vty + pl011 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 62d54560e..820caba0f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -453,6 +453,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "usb-serial", "pci-serial", "spapr-vio-serial", + "system-serial", ); =20 VIR_ENUM_IMPL(virDomainChrChannelTarget, @@ -481,6 +482,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, "usb-serial", "pci-serial", "spapr-vty", + "pl011", ); =20 VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, @@ -4061,6 +4063,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) switch ((virDomainChrSerialTargetType) def->serials[0]->targetType= ) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { =20 /* Create a stub console to match the serial port. diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 35f5c63c2..28d158980 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1082,6 +1082,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST } virDomainChrSerialTargetType; @@ -1115,6 +1116,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST } virDomainChrSerialTargetModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9a620dcdc..dfdb6231e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9234,6 +9234,7 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTarg= etModel targetModel) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: return QEMU_CAPS_DEVICE_SPAPR_VTY; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -9265,10 +9266,13 @@ qemuChrIsPlatformDevice(const virDomainDef *def, virDomainChrDefPtr chr) { if (def->os.arch =3D=3D VIR_ARCH_ARMV7L || def->os.arch =3D=3D VIR_ARC= H_AARCH64) { - /* TARGET_TYPE_ISA here really means 'the default platform device'= */ + + /* pl011 (used on mach-virt) is a platform device */ if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && - chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTE= M && + chr->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL0= 11) { return true; + } } =20 /* If we got all the way here and we're still stuck with the default @@ -10394,6 +10398,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: /* Except from _LAST, which is just a guard value and will never diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d8ab6ed52..2cc91b468 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3472,6 +3472,7 @@ qemuDomainChrSerialTargetTypeToAddressType(int target= Type) return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: break; @@ -3493,6 +3494,8 @@ qemuDomainChrSerialTargetModelToTargetType(int target= Model) return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -3529,6 +3532,16 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef= *chr) } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target type '%s' cannot have an " + "associated address"), + virDomainChrSerialTargetTypeToString(chr->t= argetType)); + return -1; + } + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: break; @@ -3540,6 +3553,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef = *chr) 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: =20 expected =3D qemuDomainChrSerialTargetModelToTargetType(chr->t= argetModel); =20 @@ -3596,6 +3610,12 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, isCompatible =3D false; } =20 + if (!qemuDomainIsVirt(def) && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYST= EM || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL= 011)) { + isCompatible =3D false; + } + if (!isCompatible) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Serial device with target type '%s' and " @@ -4247,6 +4267,8 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; } else if (qemuDomainIsPSeries(def)) { chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VI= O; + } else if (qemuDomainIsVirt(def)) { + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; } } =20 @@ -4266,6 +4288,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_= VTY; break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011; + break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: /* Nothing to do */ @@ -5182,6 +5207,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr drive= r, if (flags & VIR_DOMAIN_XML_MIGRATABLE) { switch ((virDomainChrSerialTargetType) serial->targetType)= { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: serial->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TY= PE_NONE; serial->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_M= ODEL_NONE; break; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index f62bb2f97..db9656a3a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -784,6 +784,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: return 0; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args new file mode 120000 index 000000000..1a90484d3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args @@ -0,0 +1 @@ +qemuxml2argv-mach-virt-serial-native.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml new file mode 100644 index 000000000..6aba864d0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml @@ -0,0 +1,17 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.args new file mode 100644 index 000000000..2a862bff1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.args @@ -0,0 +1,24 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-aarch64 \ +-name guest \ +-S \ +-M virt \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-device virtio-serial,id=3Dvirtio-serial0 \ +-chardev pty,id=3Dcharconsole0 \ +-device virtconsole,chardev=3Dcharconsole0,id=3Dconsole0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml new file mode 100644 index 000000000..92704504c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml @@ -0,0 +1,19 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-n= ative.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-n= ative.args new file mode 120000 index 000000000..1a90484d3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.a= rgs @@ -0,0 +1 @@ +qemuxml2argv-mach-virt-serial-native.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-n= ative.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-na= tive.xml new file mode 100644 index 000000000..549b764e9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.x= ml @@ -0,0 +1,18 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args new file mode 120000 index 000000000..1a90484d3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args @@ -0,0 +1 @@ +qemuxml2argv-mach-virt-serial-native.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xm= l b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml new file mode 100644 index 000000000..9e6be3ffe --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml @@ -0,0 +1,19 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-m= achine.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-m= achine.xml new file mode 100644 index 000000000..a8de76abf --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-machine.= xml @@ -0,0 +1,21 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.args new file mode 100644 index 000000000..f4bfce376 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.args @@ -0,0 +1,23 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-aarch64 \ +-name guest \ +-S \ +-M virt \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-chardev pty,id=3Dcharserial0 \ +-serial chardev:charserial0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xm= l b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml new file mode 100644 index 000000000..817f606ee --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml @@ -0,0 +1,16 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args = b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args new file mode 100644 index 000000000..334194efe --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args @@ -0,0 +1,26 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-aarch64 \ +-name guest \ +-S \ +-M virt \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-device i82801b11-bridge,id=3Dpci.1,bus=3Dpcie.0,addr=3D0x1 \ +-device pci-bridge,chassis_nr=3D2,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \ +-device pcie-root-port,port=3D0x10,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,add= r=3D0x2 \ +-chardev pty,id=3Dcharserial0 \ +-device pci-serial,chardev=3Dcharserial0,id=3Dserial0,bus=3Dpci.2,addr=3D0= x1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml b= /tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml new file mode 100644 index 000000000..29aa7664b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml @@ -0,0 +1,18 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args = b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args new file mode 100644 index 000000000..44c4027ac --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args @@ -0,0 +1,27 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-aarch64 \ +-name guest \ +-S \ +-M virt \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult= ifunction=3Don,\ +addr=3D0x1 \ +-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr= =3D0x1.0x1 \ +-device qemu-xhci,id=3Dusb,bus=3Dpci.1,addr=3D0x0 \ +-chardev pty,id=3Dcharserial0 \ +-device usb-serial,chardev=3Dcharserial0,id=3Dserial0,bus=3Dusb.0,port=3D1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml b= /tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml new file mode 100644 index 000000000..35f192a3e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml @@ -0,0 +1,21 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-aarch64 + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0ba23d070..593057653 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1900,6 +1900,33 @@ mymain(void) QEMU_CAPS_NODEFCONFIG); DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); =20 + DO_TEST("mach-virt-serial-native", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-serial+console-native", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-serial-compat", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-serial-pci", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_OBJECT_GPEX, + QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCI_SERIAL); + DO_TEST("mach-virt-serial-usb", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_OBJECT_GPEX, + QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_QEMU_XHCI, + QEMU_CAPS_DEVICE_USB_SERIAL); + DO_TEST("mach-virt-console-native", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-console-virtio", + QEMU_CAPS_NODEFCONFIG); + DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE); + DO_TEST("disk-ide-drive-split", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_IDE_CD); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-def= ault.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-defau= lt.xml index e5496424b..9796d7f63 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml @@ -71,7 +71,9 @@

- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-nati= ve.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.x= ml new file mode 120000 index 000000000..a4768fcf8 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.xml @@ -0,0 +1 @@ +qemuxml2xmlout-mach-virt-serial-compat.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virt= io.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virtio.x= ml new file mode 100644 index 000000000..3e46cd201 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virtio.xml @@ -0,0 +1,27 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-aarch64 + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+conso= le-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+co= nsole-native.xml new file mode 120000 index 000000000..a4768fcf8 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+console-nati= ve.xml @@ -0,0 +1 @@ +qemuxml2xmlout-mach-virt-serial-compat.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compa= t.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml new file mode 100644 index 000000000..3d7325a8d --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml @@ -0,0 +1,31 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-aarch64 + + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-nativ= e.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml new file mode 120000 index 000000000..a4768fcf8 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml @@ -0,0 +1 @@ +qemuxml2xmlout-mach-virt-serial-compat.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.x= ml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.xml new file mode 100644 index 000000000..4bcf69a3d --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.xml @@ -0,0 +1,44 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-aarch64 + + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.x= ml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml new file mode 100644 index 000000000..01c2a5255 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml @@ -0,0 +1,41 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-aarch64 + +
+ + + + + +
+ + + + +
+ + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 45cb739cd..323845340 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -790,6 +790,32 @@ mymain(void) DO_TEST("pseries-console-virtio", QEMU_CAPS_NODEFCONFIG); =20 + DO_TEST("mach-virt-serial-native", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-serial+console-native", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-serial-compat", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-serial-pci", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_OBJECT_GPEX, + QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCI_SERIAL); + DO_TEST("mach-virt-serial-usb", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_OBJECT_GPEX, + QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_QEMU_XHCI, + QEMU_CAPS_DEVICE_USB_SERIAL); + DO_TEST("mach-virt-console-native", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("mach-virt-console-virtio", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("balloon-device-auto", NONE); DO_TEST("balloon-device-period", NONE); DO_TEST("channel-virtio-auto", NONE); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 151186975431619.683426012204563; Tue, 28 Nov 2017 03:49:14 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47B75806B9; Tue, 28 Nov 2017 11:49:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1644F5D973; Tue, 28 Nov 2017 11:49:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A93F81801211; Tue, 28 Nov 2017 11:49:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnAcZ008902 for ; Tue, 28 Nov 2017 06:49:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id ABFDD512E9; Tue, 28 Nov 2017 11:49:10 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7744E60484 for ; Tue, 28 Nov 2017 11:49:07 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:04 +0100 Message-Id: <20171128114813.28509-22-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 21/30] conf: add VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 28 Nov 2017 11:49:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Pino Toscano Introduce specific a target types with two models for the console devices (sclp and sclplm) used in s390 and s390x guests, so isa-serial is no more used for them. This makes usable on s390 and s390x guests, with at most only a single sclpconsole and one sclplmconsole devices usable in a single guest (due to limitations in QEMU, which will enforce already at runtime). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1449265 Signed-off-by: Pino Toscano Reviewed-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- docs/formatdomain.html.in | 19 ++++++++---- docs/schemas/domaincommon.rng | 3 ++ src/conf/domain_conf.c | 4 +++ src/conf/domain_conf.h | 3 ++ src/qemu/qemu_command.c | 6 ++++ src/qemu/qemu_domain.c | 20 +++++++++++++ src/qemu/qemu_domain_address.c | 1 + .../qemuxml2argv-s390-serial-2.args | 24 +++++++++++++++ .../qemuxml2argv-s390-serial-2.xml | 19 ++++++++++++ .../qemuxml2argv-s390-serial-console.args | 25 ++++++++++++++++ .../qemuxml2argv-s390-serial-console.xml | 15 ++++++++++ .../qemuxml2argvdata/qemuxml2argv-s390-serial.args | 22 ++++++++++++++ .../qemuxml2argvdata/qemuxml2argv-s390-serial.xml | 14 +++++++++ tests/qemuxml2argvtest.c | 16 ++++++++++ .../qemuxml2xmlout-s390-serial-2.xml | 33 ++++++++++++++++++= +++ .../qemuxml2xmlout-s390-serial-console.xml | 34 ++++++++++++++++++= ++++ .../qemuxml2xmlout-s390-serial.xml | 28 ++++++++++++++++++ tests/qemuxml2xmltest.c | 6 ++++ 18 files changed, 286 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console= .args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console= .xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.x= ml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-con= sole.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8cccccc52..29a968146 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6547,8 +6547,9 @@ qemu-kvm -net nic,model=3D? /dev/null with x86 guests), usb-serial (usable whenever USB suppo= rt is available) and pci-serial (usable whenever PCI suppo= rt is available); since 3.10.0, - spapr-vio-serial (usable with ppc64/pseries guests) and - system-serial (usable with aarch64/virt guests) are + spapr-vio-serial (usable with ppc64/pseries guests), + system-serial (usable with aarch64/virt guests) and + sclp-serial (usable with s390 and s390x guests) are available as well.

=20 @@ -6562,7 +6563,9 @@ qemu-kvm -net nic,model=3D? /dev/null (usable with the pci-serial target type); spapr-vty (usable with the spapr-vio-serial target type); pl011 (usable with the - system-serial target type). + system-serial target type); sclpconsole and + sclplmconsole (usable with the sclp-serial + target type).

=20

@@ -6577,7 +6580,8 @@ qemu-kvm -net nic,model=3D? /dev/null isa-serial), usb (for usb-serial), pci (for pci-serial) and spapr-vio (for spapr-vio-serial). The system-serial - target type doesn't support specifying an address. + and sclp-serial target types don't support specifying an + address.

=20

@@ -6625,8 +6629,11 @@ qemu-kvm -net nic,model=3D? /dev/null virtio (usable whenever VirtIO support is available); xen, lxc, uml and openvz (available when the corresponding hypervisor is = in - use); sclp and sclplm (usable for s390 and - s390x QEMU guests). + use). sclp and sclplm (usable for s390 and + s390x QEMU guests) are supported for compatibility reasons but should + not be used for new guests: use the sclpconsole and + sclplmconsole target models, respectively, with the + serial element instead.

=20

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5fff3a40f..5b9fc162c 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3587,6 +3587,7 @@ pci-serial spapr-vio-serial system-serial + sclp-serial @@ -3600,6 +3601,8 @@ pci-serial spapr-vty pl011 + sclpconsole + sclplmconsole diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 820caba0f..b31917dad 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -454,6 +454,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "pci-serial", "spapr-vio-serial", "system-serial", + "sclp-serial", ); =20 VIR_ENUM_IMPL(virDomainChrChannelTarget, @@ -483,6 +484,8 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, "pci-serial", "spapr-vty", "pl011", + "sclpconsole", + "sclplmconsole", ); =20 VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, @@ -4064,6 +4067,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { =20 /* Create a stub console to match the serial port. diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 28d158980..48b07226e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1083,6 +1083,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST } virDomainChrSerialTargetType; @@ -1117,6 +1118,8 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST } virDomainChrSerialTargetModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dfdb6231e..1a5e9824a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9233,6 +9233,10 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTar= getModel targetModel) return QEMU_CAPS_DEVICE_PCI_SERIAL; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: return QEMU_CAPS_DEVICE_SPAPR_VTY; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: + return QEMU_CAPS_DEVICE_SCLPCONSOLE; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + return QEMU_CAPS_DEVICE_SCLPLMCONSOLE; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: @@ -10384,6 +10388,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, 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_SCLPCONSOLE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: =20 caps =3D qemuChrSerialTargetModelToCaps(serial->targetModel); =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2cc91b468..b3b34348b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3473,6 +3473,7 @@ qemuDomainChrSerialTargetTypeToAddressType(int target= Type) case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: break; @@ -3496,6 +3497,9 @@ qemuDomainChrSerialTargetModelToTargetType(int target= Model) return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -3533,6 +3537,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef = *chr) break; =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target type '%s' cannot have an " @@ -3554,6 +3559,8 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef = *chr) 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: =20 expected =3D qemuDomainChrSerialTargetModelToTargetType(chr->t= argetModel); =20 @@ -3616,6 +3623,13 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, isCompatible =3D false; } =20 + if (!ARCH_IS_S390(def->os.arch) && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP= || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SC= LPCONSOLE || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SC= LPLMCONSOLE)) { + isCompatible =3D false; + } + if (!isCompatible) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Serial device with target type '%s' and " @@ -4269,6 +4283,8 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VI= O; } else if (qemuDomainIsVirt(def)) { chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; + } else if (ARCH_IS_S390(def->os.arch)) { + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; } } =20 @@ -4291,6 +4307,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011; break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCO= NSOLE; + break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: /* Nothing to do */ @@ -5214,6 +5233,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr drive= r, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: /* Nothing to do */ diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index db9656a3a..a40cdb399 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -785,6 +785,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: return 0; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args b/tests= /qemuxml2argvdata/qemuxml2argv-s390-serial-2.args new file mode 100644 index 000000000..346dcd16b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args @@ -0,0 +1,24 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-chardev pty,id=3Dcharserial0 \ +-device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 \ +-chardev pty,id=3Dcharserial1 \ +-device sclplmconsole,chardev=3Dcharserial1,id=3Dserial1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml b/tests/= qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml new file mode 100644 index 000000000..b6eb377c9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + /usr/bin/qemu-system-s390x + + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args b= /tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args new file mode 100644 index 000000000..c405fb59e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args @@ -0,0 +1,25 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-device virtio-serial-ccw,id=3Dvirtio-serial0,devno=3Dfe.0.0000 \ +-chardev pty,id=3Dcharserial0 \ +-device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 \ +-chardev pty,id=3Dcharconsole1 \ +-device virtconsole,chardev=3Dcharconsole1,id=3Dconsole1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml b/= tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml new file mode 100644 index 000000000..c841f1f24 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml @@ -0,0 +1,15 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + /usr/bin/qemu-system-s390x + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args b/tests/q= emuxml2argvdata/qemuxml2argv-s390-serial.args new file mode 100644 index 000000000..20968f794 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args @@ -0,0 +1,22 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-chardev pty,id=3Dcharserial0 \ +-device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml b/tests/qe= muxml2argvdata/qemuxml2argv-s390-serial.xml new file mode 100644 index 000000000..55b45bac0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml @@ -0,0 +1,14 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + /usr/bin/qemu-system-s390x + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 593057653..d9ed8af79 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2051,6 +2051,22 @@ mymain(void) QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_DEVICE_SCLPCONSOLE); + DO_TEST("s390-serial-2", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_DEVICE_SCLPCONSOLE, + QEMU_CAPS_DEVICE_SCLPLMCONSOLE); + DO_TEST("s390-serial-console", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_DEVICE_SCLPCONSOLE); =20 DO_TEST("ppc-dtb", QEMU_CAPS_KVM, diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml new file mode 100644 index 000000000..bb9ca30f1 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml new file mode 100644 index 000000000..db3023b7a --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + +

+ + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml b/test= s/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml new file mode 100644 index 000000000..9c9b4dd27 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml @@ -0,0 +1,28 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 323845340..146a67ee2 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1157,6 +1157,12 @@ mymain(void) QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("s390-panic-no-address", QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial-2", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial-console", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); =20 DO_TEST("pcihole64", NONE); DO_TEST("pcihole64-gib", NONE); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869756803466.5102965025826; Tue, 28 Nov 2017 03:49:16 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF08D4901D; Tue, 28 Nov 2017 11:49:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C79B960F87; Tue, 28 Nov 2017 11:49:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9009A3D385; Tue, 28 Nov 2017 11:49:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnDG2008929 for ; Tue, 28 Nov 2017 06:49:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id A28BD60176; Tue, 28 Nov 2017 11:49:13 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C09FD60561 for ; Tue, 28 Nov 2017 11:49:10 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:05 +0100 Message-Id: <20171128114813.28509-23-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 22/30] conf: pass parseFlags down to virDomainDefAddConsoleCompat X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:49:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Pino Toscano Signed-off-by: Pino Toscano Reviewed-by: Andrea Bolognani --- src/conf/domain_conf.c | 10 ++++++---- src/conf/domain_conf.h | 3 ++- src/vz/vz_sdk.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b31917dad..792d9bef4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3987,7 +3987,8 @@ virDomainDefPostParseMemory(virDomainDefPtr def, =20 =20 static int -virDomainDefAddConsoleCompat(virDomainDefPtr def) +virDomainDefAddConsoleCompat(virDomainDefPtr def, + unsigned int parseFlags ATTRIBUTE_UNUSED) { size_t i; =20 @@ -4948,7 +4949,7 @@ virDomainDefPostParseCommon(virDomainDefPtr def, if (virDomainDefPostParseTimer(def) < 0) return -1; =20 - if (virDomainDefAddImplicitDevices(def) < 0) + if (virDomainDefAddImplicitDevices(def, data->parseFlags) < 0) return -1; =20 if (def->nvideos !=3D 0) { @@ -22017,9 +22018,10 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def) } =20 int -virDomainDefAddImplicitDevices(virDomainDefPtr def) +virDomainDefAddImplicitDevices(virDomainDefPtr def, + unsigned int parseFlags) { - if (virDomainDefAddConsoleCompat(def) < 0) + if (virDomainDefAddConsoleCompat(def, parseFlags) < 0) return -1; =20 if (virDomainDefAddImplicitControllers(def) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 48b07226e..6e23cdd7d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2945,7 +2945,8 @@ bool virDomainDefCheckABIStabilityFlags(virDomainDefP= tr src, virDomainXMLOptionPtr xmlopt, unsigned int flags); =20 -int virDomainDefAddImplicitDevices(virDomainDefPtr def); +int virDomainDefAddImplicitDevices(virDomainDefPtr def, + unsigned int parseFlags); =20 virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(const virDomainDef *def, unsigned int iothread_id= ); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index eea5f6fc6..35522f46c 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1932,7 +1932,7 @@ prlsdkLoadDomain(vzDriverPtr driver, if (prlsdkGetDomainState(dom, sdkdom, &domainState) < 0) goto error; =20 - if (!IS_CT(def) && virDomainDefAddImplicitDevices(def) < 0) + if (!IS_CT(def) && virDomainDefAddImplicitDevices(def, 0) < 0) goto error; =20 if (def->ngraphics > 0) { --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869759745652.2681795259965; Tue, 28 Nov 2017 03:49:19 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 802DE5D68D; Tue, 28 Nov 2017 11:49:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C51560619; Tue, 28 Nov 2017 11:49:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2252C1803B20; Tue, 28 Nov 2017 11:49:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnHgZ008996 for ; Tue, 28 Nov 2017 06:49:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 55D8960486; Tue, 28 Nov 2017 11:49:17 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 759FF600D1 for ; Tue, 28 Nov 2017 11:49:13 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:06 +0100 Message-Id: <20171128114813.28509-24-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 23/30] conf: convert sclp/sclplm as X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 28 Nov 2017 11:49:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Pino Toscano In case we are allowed to break the ABI of a s390/s390x guest, then convert the first sclp/sclplm console from to , just like it is done on other architectures. Signed-off-by: Pino Toscano Reviewed-by: Andrea Bolognani Reviewed-by: Bjoern Walk --- It's still unclear whether this patch can be included. See https://www.redhat.com/archives/libvir-list/2017-November/msg00996.html src/conf/domain_conf.c | 46 ++++++++++++++++++= ++-- .../qemuxml2argv-s390-console2serial.args | 22 +++++++++++ .../qemuxml2argv-s390-console2serial.xml | 19 +++++++++ tests/qemuxml2argvtest.c | 6 +++ 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial= .args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial= .xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 792d9bef4..29afcb6c5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3986,9 +3986,40 @@ virDomainDefPostParseMemory(virDomainDefPtr def, } =20 =20 +static void +virDomainChrConsoleTargetTypeToSerial(virDomainChrConsoleTargetType type, + int *targetType, + int *targetModel) +{ + switch (type) { + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: + *targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + *targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE; + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: + *targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + *targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE; + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST: + *targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + *targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE; + break; + } +} + + static int virDomainDefAddConsoleCompat(virDomainDefPtr def, - unsigned int parseFlags ATTRIBUTE_UNUSED) + unsigned int parseFlags) { size_t i; =20 @@ -4005,6 +4036,10 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, * * We then fill def->consoles[0] with a stub just so we get sequencing * correct for consoles > 0 + * + * sclp/sclplm consoles (in s390 and s390x guests) are converted to se= rial + * only when we can update the ABI of the guest, to avoid breaking + * migrations to old libvirt. */ =20 /* Only the first console (if there are any) can be of type serial, @@ -4021,7 +4056,10 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, } if (def->nconsoles > 0 && def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && (def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_SERIAL || - def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_NONE)) { + def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_NONE || + ((def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARG= ET_TYPE_SCLP || + def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARG= ET_TYPE_SCLPLM) && + (parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)))) { =20 /* If there isn't a corresponding serial port: * - create one and set, the console to be an alias for it @@ -4041,7 +4079,9 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, =20 /* modify it to be a serial port */ def->serials[0]->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SER= IAL; - def->serials[0]->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_T= YPE_NONE; + virDomainChrConsoleTargetTypeToSerial(def->serials[0]->targetT= ype, + &def->serials[0]->target= Type, + &def->serials[0]->target= Model); def->serials[0]->target.port =3D 0; } else { /* if the console source doesn't match */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.args b= /tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.args new file mode 100644 index 000000000..20968f794 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.args @@ -0,0 +1,22 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-chardev pty,id=3Dcharserial0 \ +-device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml b/= tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml new file mode 100644 index 000000000..5f02ec8a0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + /usr/bin/qemu-system-s390x + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d9ed8af79..9480f865f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2067,6 +2067,12 @@ mymain(void) QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_SCLPCONSOLE); + DO_TEST_FULL("s390-console2serial", NULL, -1, 0, + VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, GIC_NONE, + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_DEVICE_SCLPCONSOLE); =20 DO_TEST("ppc-dtb", QEMU_CAPS_KVM, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869762227277.1569807815903; Tue, 28 Nov 2017 03:49:22 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E99B4DD7C; Tue, 28 Nov 2017 11:49:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A2E45D972; Tue, 28 Nov 2017 11:49:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E8ED93D389; Tue, 28 Nov 2017 11:49:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnJN5009024 for ; Tue, 28 Nov 2017 06:49:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 93604600D1; Tue, 28 Nov 2017 11:49:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F6C560560 for ; Tue, 28 Nov 2017 11:49:17 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:07 +0100 Message-Id: <20171128114813.28509-25-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 24/30] qemu: switch s390/s390x default console back to serial X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:49:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Pino Toscano Now that and on s390/s390x behave a bit more like the other architectures, remove this extra differentation, and use sclp console by default for new guests. New virtio consoles can still be added, and it is actually needed because of the limited number of instances for sclp and sclplm. This reverts commit b1c88c14764e0b043a269d454a83a6ac7af34eac, whose reasons are not totally clear. Signed-off-by: Pino Toscano Reviewed-by: Andrea Bolognani Reviewed-by: Bjoern Walk --- src/qemu/qemu_domain.c | 7 ------- tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args | 5 +---- tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml | 8 ++++++= -- tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml | 6 ------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b3b34348b..d1e391f48 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4259,13 +4259,6 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, virQEMUDriverPtr driver, unsigned int parseFlags) { - /* set the default console type for S390 arches */ - if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && - chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE && - ARCH_IS_S390(def->os.arch)) { - chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; - } - /* Historically, isa-serial and the default matched, so in order to * maintain backwards compatibility we map them here. The actual defau= lt * will be picked below based on the architecture and machine type. */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args b= /tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args index c405fb59e..20968f794 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args @@ -18,8 +18,5 @@ QEMU_AUDIO_DRV=3Dnone \ server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ -boot c \ --device virtio-serial-ccw,id=3Dvirtio-serial0,devno=3Dfe.0.0000 \ -chardev pty,id=3Dcharserial0 \ --device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 \ --chardev pty,id=3Dcharconsole1 \ --device virtconsole,chardev=3Dcharconsole1,id=3Dconsole1 +-device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml index 7eb1a765a..0f278f2c9 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml @@ -14,9 +14,13 @@ destroy /usr/bin/qemu-system-s390x - + + + + + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml index db3023b7a..9c9b4dd27 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml @@ -14,9 +14,6 @@ destroy /usr/bin/qemu-system-s390x - -
- @@ -25,9 +22,6 @@ - - - --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869764776303.7435463767548; Tue, 28 Nov 2017 03:49:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E59A34ACBC; Tue, 28 Nov 2017 11:49:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4C0F60175; Tue, 28 Nov 2017 11:49:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8EAD93D391; Tue, 28 Nov 2017 11:49:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnMJT009042 for ; Tue, 28 Nov 2017 06:49:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A7EF60175; Tue, 28 Nov 2017 11:49:22 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BE066047A for ; Tue, 28 Nov 2017 11:49:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:08 +0100 Message-Id: <20171128114813.28509-26-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 25/30] qemu: Add QEMU_CAPS_DEVICE_ISA_SERIAL X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Nov 2017 11:49:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All serial devices shoule have an associated capability. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + tests/qemuhelptest.c | 5 +++++ 24 files changed, 29 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f2d24a309..cd519cb3c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -452,6 +452,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "numa.dist", "disk-share-rw", "iscsi.password-secret", + "isa-serial", ); =20 =20 @@ -1682,6 +1683,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO }, { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY }, { "sclplmconsole", QEMU_CAPS_DEVICE_SCLPLMCONSOLE }, + { "isa-serial", QEMU_CAPS_DEVICE_ISA_SERIAL }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 68a2541d3..fc043b075 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -438,6 +438,7 @@ typedef enum { QEMU_CAPS_NUMA_DIST, /* -numa dist */ QEMU_CAPS_DISK_SHARE_RW, /* share-rw=3Don for concurrent disk access */ QEMU_CAPS_ISCSI_PASSWORD_SECRET, /* -drive file.driver=3Discsi,...,pas= sword-secret=3D */ + QEMU_CAPS_DEVICE_ISA_SERIAL, /* -device isa-serial */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.2.2.x86_64.xml index 956284d5d..d560811ab 100644 --- a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml @@ -109,6 +109,7 @@ + 1002002 0 diff --git a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.3.1.x86_64.xml index 99384ce5e..576475f7f 100644 --- a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml @@ -127,6 +127,7 @@ + 1003001 0 diff --git a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.4.2.x86_64.xml index aea043c57..0c271d3e4 100644 --- a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml @@ -128,6 +128,7 @@ + 1004002 0 diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.5.3.x86_64.xml index 6f860e4f2..5c667975b 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml @@ -140,6 +140,7 @@ + 1005003 0 diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.6.0.x86_64.xml index e5dc8360d..8ae07a91d 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml @@ -145,6 +145,7 @@ + 1006000 0 diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.7.0.x86_64.xml index 86d87eaf0..34bd6be1c 100644 --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml @@ -147,6 +147,7 @@ + 1007000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.1.1.x86_64.xml index 2fa551b1a..0d7c144ff 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml @@ -163,6 +163,7 @@ + 2001001 0 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml index 96b42bbe9..b4dc8f196 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml @@ -183,6 +183,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml index 79866a025..f2f598967 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml @@ -183,6 +183,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.ppc64.xml index 5f97bc393..ca55e11eb 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -182,6 +182,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.10.0.x86_64.xml index ec7f29cc1..8fea70a52 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -227,6 +227,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.4.0.x86_64.xml index f97e4cb81..5007523c1 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml @@ -188,6 +188,7 @@ + 2004000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.5.0.x86_64.xml index 2ba40fc49..a9ad292d0 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml @@ -194,6 +194,7 @@ + 2005000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml index 0b34fa30d..e699bdbaf 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml @@ -172,6 +172,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml index d41d578c7..f4c1de7e1 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml @@ -172,6 +172,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_2.6.0.ppc64.xml index 5ff8598fc..27d99bd93 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml @@ -168,6 +168,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.6.0.x86_64.xml index bdf006f6b..97621612a 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml @@ -204,6 +204,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.7.0.x86_64.xml index 59adff6c9..e4ea9452c 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml @@ -208,6 +208,7 @@ + 2007000 0 (v2.7.0) diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.8.0.x86_64.xml index 3165b2dee..c6d3e21d5 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml @@ -210,6 +210,7 @@ + 2008000 0 (v2.8.0) diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_2.9.0.ppc64.xml index 4e712f69e..96aa5d59f 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml @@ -176,6 +176,7 @@ + 2009000 0 (v2.9.0) diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 4e8079d8f..9f489129f 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -223,6 +223,7 @@ + 2009000 0 (v2.9.0) diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 2280e96a3..1336eeef5 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -174,6 +174,7 @@ mymain(void) QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_DEVICE_RTL8139, QEMU_CAPS_DEVICE_E1000, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_VIRTIO_NET); DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0, QEMU_CAPS_DRIVE_BOOT, @@ -210,6 +211,7 @@ mymain(void) QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_DEVICE_RTL8139, QEMU_CAPS_DEVICE_E1000, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_VIRTIO_NET); DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0, QEMU_CAPS_DRIVE_BOOT, @@ -258,6 +260,7 @@ mymain(void) QEMU_CAPS_DEVICE_IVSHMEM, QEMU_CAPS_DEVICE_RTL8139, QEMU_CAPS_DEVICE_E1000, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_VIRTIO_NET); DO_TEST("qemu-1.0", 1000000, 0, 0, QEMU_CAPS_DRIVE_CACHE_UNSAFE, @@ -328,6 +331,7 @@ mymain(void) QEMU_CAPS_DEVICE_RTL8139, QEMU_CAPS_DEVICE_E1000, QEMU_CAPS_DEVICE_VIRTIO_NET, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DISPLAY); DO_TEST("qemu-1.1.0", 1001000, 0, 0, QEMU_CAPS_DRIVE_CACHE_UNSAFE, @@ -411,6 +415,7 @@ mymain(void) QEMU_CAPS_DEVICE_RTL8139, QEMU_CAPS_DEVICE_E1000, QEMU_CAPS_DEVICE_VIRTIO_NET, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DISPLAY); DO_TEST_FULL("qemu-1.2.0", 1002000, 0, 0, VIR_ERR_CONFIG_UNSUPPORTED, QEMU_CAPS_LAST); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869768396203.3304765197787; Tue, 28 Nov 2017 03:49:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABD4B7F41E; Tue, 28 Nov 2017 11:49:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88E965C88B; Tue, 28 Nov 2017 11:49:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4DAEC1802130; Tue, 28 Nov 2017 11:49:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnOvp009058 for ; Tue, 28 Nov 2017 06:49:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id B0B1D60175; Tue, 28 Nov 2017 11:49:24 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC8AD60317 for ; Tue, 28 Nov 2017 11:49:22 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:09 +0100 Message-Id: <20171128114813.28509-27-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 26/30] qemu: Require QEMU_CAPS_DEVICE_ISA_SERIAL for isa-serial X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 28 Nov 2017 11:49:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We should make sure the isa-serial device is available before formatting it on the QEMU command line. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 7 +++---- tests/qemuxml2argvtest.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1a5e9824a..49503fb2c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9227,6 +9227,8 @@ static virQEMUCapsFlags qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel) { switch (targetModel) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + return QEMU_CAPS_DEVICE_ISA_SERIAL; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: return QEMU_CAPS_DEVICE_USB_SERIAL; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: @@ -9237,7 +9239,6 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTarg= etModel targetModel) return QEMU_CAPS_DEVICE_SCLPCONSOLE; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: return QEMU_CAPS_DEVICE_SCLPLMCONSOLE; - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: @@ -10385,6 +10386,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, virQEMUCapsFlags caps; =20 switch ((virDomainChrSerialTargetModel) serial->targetModel) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: 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: @@ -10401,9 +10403,6 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: - break; - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 9480f865f..cd6c66b3f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -771,6 +771,7 @@ mymain(void) DO_TEST_FAILURE("reboot-timeout-enabled", NONE); =20 DO_TEST("bios", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_SGA); DO_TEST("bios-nvram", NONE); DO_TEST("bios-nvram-secure", @@ -814,6 +815,7 @@ mymain(void) QEMU_CAPS_SPICE, QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_HUB, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("eoi-disabled", NONE); DO_TEST("eoi-enabled", NONE); @@ -1231,48 +1233,64 @@ mymain(void) =20 DO_TEST("serial-file-log", QEMU_CAPS_CHARDEV_FILE_APPEND, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_CHARDEV_LOGFILE); DO_TEST("serial-spiceport", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_CHARDEV_SPICEPORT); DO_TEST("serial-spiceport-nospice", NONE); =20 - DO_TEST("console-compat", NONE); - DO_TEST("console-compat-auto", NONE); + DO_TEST("console-compat", + QEMU_CAPS_DEVICE_ISA_SERIAL); + DO_TEST("console-compat-auto", + QEMU_CAPS_DEVICE_ISA_SERIAL); =20 DO_TEST("serial-vc-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-pty-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-dev-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-dev-chardev-iobase", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-file-chardev", QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_CHARDEV_FILE_APPEND); DO_TEST("serial-unix-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-tcp-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-udp-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-tcp-telnet-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); driver.config->chardevTLS =3D 1; DO_TEST("serial-tcp-tlsx509-chardev", QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_OBJECT_TLS_CREDS_X509); driver.config->chardevTLSx509verify =3D 1; DO_TEST("serial-tcp-tlsx509-chardev-verify", QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_OBJECT_TLS_CREDS_X509); driver.config->chardevTLSx509verify =3D 0; DO_TEST("serial-tcp-tlsx509-chardev-notls", QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_OBJECT_TLS_CREDS_X509); VIR_FREE(driver.config->chardevTLSx509certdir); if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/l= ibvirt-chardev") < 0) @@ -1284,22 +1302,26 @@ mymain(void) DO_TEST("serial-tcp-tlsx509-secret-chardev", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_OBJECT_SECRET, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_OBJECT_TLS_CREDS_X509); # else DO_TEST_FAILURE("serial-tcp-tlsx509-secret-chardev", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_OBJECT_SECRET, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_OBJECT_TLS_CREDS_X509); # endif driver.config->chardevTLS =3D 0; VIR_FREE(driver.config->chardevTLSx509certdir); DO_TEST("serial-many-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("parallel-tcp-chardev", QEMU_CAPS_NODEFCONFIG); DO_TEST("parallel-parport-chardev", QEMU_CAPS_NODEFCONFIG); DO_TEST("console-compat-chardev", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("pci-serial-dev-chardev", QEMU_CAPS_NODEFCONFIG, @@ -1320,6 +1342,7 @@ mymain(void) DO_TEST("console-virtio", QEMU_CAPS_NODEFCONFIG); DO_TEST("console-virtio-many", + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_NODEFCONFIG); DO_TEST("console-virtio-s390", QEMU_CAPS_NODEFCONFIG, @@ -2318,6 +2341,7 @@ mymain(void) QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_HDA_DUPLEX, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_USB_REDIR); =20 /* Test automatic and manual setting of pcie-root-port attributes */ @@ -2922,6 +2946,7 @@ mymain(void) DO_TEST("user-aliases", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC, + QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_HDA_DUPLEX); DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI= ); =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869769823189.83276588172384; Tue, 28 Nov 2017 03:49:29 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6D067CB8F; Tue, 28 Nov 2017 11:49:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB72D6198D; Tue, 28 Nov 2017 11:49:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6CD751802133; Tue, 28 Nov 2017 11:49:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnQVk009066 for ; Tue, 28 Nov 2017 06:49:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8A56D60317; Tue, 28 Nov 2017 11:49:26 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A659A60175 for ; Tue, 28 Nov 2017 11:49:25 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:10 +0100 Message-Id: <20171128114813.28509-28-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 27/30] qemu: Limit isa-serial usage to x86 guests X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 28 Nov 2017 11:49:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The ISA bus is x86 specific, so we should limit usage of isa-serial to x86 guests only, just like we already do eg. with sclpconsole and s390x guests. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d1e391f48..cf4af14dd 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3611,6 +3611,12 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { bool isCompatible =3D true; =20 + if (!ARCH_IS_X86(def->os.arch) && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA = || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_IS= A_SERIAL)) { + isCompatible =3D false; + } + if (!qemuDomainIsPSeries(def) && (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAP= R_VIO || dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SP= APR_VTY)) { --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15118697707151003.9892431340971; Tue, 28 Nov 2017 03:49:30 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A97071287; Tue, 28 Nov 2017 11:49:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7968460619; Tue, 28 Nov 2017 11:49:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 36E6F1802137; Tue, 28 Nov 2017 11:49:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnSu9009079 for ; Tue, 28 Nov 2017 06:49:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7D2E460317; Tue, 28 Nov 2017 11:49:28 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9793B61346 for ; Tue, 28 Nov 2017 11:49:26 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:11 +0100 Message-Id: <20171128114813.28509-29-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 28/30] qemu: Add QEMU_CAPS_DEVICE_PL011 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Nov 2017 11:49:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All serial devices shoule have an associated capability. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 + 6 files changed, 11 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index cd519cb3c..b5cfa70c5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -453,6 +453,9 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "disk-share-rw", "iscsi.password-secret", "isa-serial", + + /* 280 */ + "pl011", ); =20 =20 @@ -1684,6 +1687,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY }, { "sclplmconsole", QEMU_CAPS_DEVICE_SCLPLMCONSOLE }, { "isa-serial", QEMU_CAPS_DEVICE_ISA_SERIAL }, + { "pl011", QEMU_CAPS_DEVICE_PL011 }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index fc043b075..9f239a0ec 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -440,6 +440,9 @@ typedef enum { QEMU_CAPS_ISCSI_PASSWORD_SECRET, /* -drive file.driver=3Discsi,...,pas= sword-secret=3D */ QEMU_CAPS_DEVICE_ISA_SERIAL, /* -device isa-serial */ =20 + /* 280 */ + QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml index b4dc8f196..eeb1840d3 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml @@ -184,6 +184,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml index f2f598967..1e7b95ec0 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml @@ -184,6 +184,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml index e699bdbaf..d3e2e18fa 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml @@ -173,6 +173,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml index f4c1de7e1..bc86d0353 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml @@ -173,6 +173,7 @@ + 2006000 0 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869773892543.3292279034764; Tue, 28 Nov 2017 03:49:33 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED8D6C0587EA; Tue, 28 Nov 2017 11:49:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C663C60317; Tue, 28 Nov 2017 11:49:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8BFB23D395; Tue, 28 Nov 2017 11:49:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnURn009110 for ; Tue, 28 Nov 2017 06:49:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id EE9BB60486; Tue, 28 Nov 2017 11:49:30 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A74060484 for ; Tue, 28 Nov 2017 11:49:28 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:12 +0100 Message-Id: <20171128114813.28509-30-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 29/30] qemu: Require QEMU_CAPS_DEVICE_PL011 for pl011 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 28 Nov 2017 11:49:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Even though we never format the device on the QEMU command line, as it's a platform serial device that's not user-instantiable, we should still make sure it's available before using it. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 12 ++++++++++++ tests/qemuxml2argvtest.c | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 49503fb2c..c78f1b83b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9240,6 +9240,7 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTarg= etModel targetModel) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: return QEMU_CAPS_DEVICE_SCLPLMCONSOLE; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + return QEMU_CAPS_DEVICE_PL011; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -9332,6 +9333,17 @@ qemuBuildSerialCommandLine(virLogManagerPtr logManag= er, if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) = < 0) return -1; } else { + virQEMUCapsFlags caps; + + caps =3D qemuChrSerialTargetModelToCaps(serial->targetModel); + + if (caps && !virQEMUCapsGet(qemuCaps, caps)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("'%s' is not supported in this QEMU binar= y"), + virDomainChrSerialTargetModelTypeToString(s= erial->targetModel)); + return -1; + } + virCommandAddArg(cmd, "-serial"); virCommandAddArgFormat(cmd, "chardev:char%s", serial->info.ali= as); } diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cd6c66b3f..7a606cef9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1924,10 +1924,13 @@ mymain(void) DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); =20 DO_TEST("mach-virt-serial-native", + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_NODEFCONFIG); DO_TEST("mach-virt-serial+console-native", + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_NODEFCONFIG); DO_TEST("mach-virt-serial-compat", + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_NODEFCONFIG); DO_TEST("mach-virt-serial-pci", QEMU_CAPS_NODEFCONFIG, @@ -1945,6 +1948,7 @@ mymain(void) QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_DEVICE_USB_SERIAL); DO_TEST("mach-virt-console-native", + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_NODEFCONFIG); DO_TEST("mach-virt-console-virtio", QEMU_CAPS_NODEFCONFIG); @@ -2506,11 +2510,13 @@ mymain(void) DO_TEST("arm-virt-virtio", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); =20 DO_TEST("aarch64-virt-virtio", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); =20 /* Demonstrates the virtio-pci default... namely that there isn't any! @@ -2526,6 +2532,7 @@ mymain(void) QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("aarch64-virt-2.6-virtio-pci-default", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, @@ -2534,6 +2541,7 @@ mymain(void) QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_DEVICE_IOH3420); /* Example of using virtio-pci with no explicit PCI controller but with manual PCI addresses */ @@ -2652,6 +2660,7 @@ mymain(void) QEMU_CAPS_MACH_VIRT_GIC_VERSION); DO_TEST("aarch64-kvm-32-on-64", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO, + QEMU_CAPS_DEVICE_PL011, QEMU_CAPS_KVM, QEMU_CAPS_CPU_AARCH64_OFF); DO_TEST_FAILURE("aarch64-kvm-32-on-64", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 09:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511869777384458.2934302262099; Tue, 28 Nov 2017 03:49:37 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A4D281226; Tue, 28 Nov 2017 11:49:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64C235C1A3; Tue, 28 Nov 2017 11:49:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 241631801212; Tue, 28 Nov 2017 11:49:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASBnYog009139 for ; Tue, 28 Nov 2017 06:49:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id D28BF60176; Tue, 28 Nov 2017 11:49:34 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-77.brq.redhat.com [10.40.204.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9F58620A1 for ; Tue, 28 Nov 2017 11:49:31 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Nov 2017 12:48:13 +0100 Message-Id: <20171128114813.28509-31-abologna@redhat.com> In-Reply-To: <20171128114813.28509-1-abologna@redhat.com> References: <20171128114813.28509-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 30/30] news: Update for serial console fixes X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 28 Nov 2017 11:49:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- docs/news.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 104668ce9..397e382b9 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -148,6 +148,18 @@ can prepare the files if they need to do so. + + + Improve serial console behavior on non-x86 architectures + + + ppc64, aarch64 and s390x guests were treating the <serial> + and <console> elements differently from x86, in some cases + presenting misleading information to the user. The behavior is n= ow + consistent across all architectures and the information reported + is always accurate. + +
--=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list