From nobody Wed May 1 14:08:07 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 1511282573487431.13693007962047; Tue, 21 Nov 2017 08:42: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 7724D61D1D; Tue, 21 Nov 2017 16:42:51 +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 DC6B55EE1E; Tue, 21 Nov 2017 16:42: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 159641800BDA; Tue, 21 Nov 2017 16:42: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 vALGgmck025753 for ; Tue, 21 Nov 2017 11:42:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 35E9D6C412; Tue, 21 Nov 2017 16:42:48 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48F9E6F43E for ; Tue, 21 Nov 2017 16:42:44 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:11 +0100 Message-Id: <20171121164231.15008-2-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 01/21] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 21 Nov 2017 16:42:51 +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: Marc Hartmayer Reviewed-by: Pavel Hrdina --- 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 cc7596bad..c6ba4079d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4036,6 +4036,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, @@ -4096,29 +4125,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) @@ -4154,6 +4160,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 Wed May 1 14:08:07 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 151128258589264.91838690794441; Tue, 21 Nov 2017 08:43:05 -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 A7F37806B9; Tue, 21 Nov 2017 16:43:03 +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 81E906C412; Tue, 21 Nov 2017 16:43: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 49F781800BDF; Tue, 21 Nov 2017 16:43: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 vALGgole025763 for ; Tue, 21 Nov 2017 11:42:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id EE9DC6C412; Tue, 21 Nov 2017 16:42:50 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D7666C435 for ; Tue, 21 Nov 2017 16:42:48 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:12 +0100 Message-Id: <20171121164231.15008-3-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 02/21] 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 21 Nov 2017 16:43:04 +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 969a6632b..20a4acd74 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4939,6 +4939,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 Wed May 1 14:08:07 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 1511282591850628.41707753867; Tue, 21 Nov 2017 08:43:11 -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 B9AC468691; Tue, 21 Nov 2017 16:43:06 +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 93EDF60C80; Tue, 21 Nov 2017 16:43: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 5E38E3FCFD; Tue, 21 Nov 2017 16:43: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 vALGgqdR025771 for ; Tue, 21 Nov 2017 11:42:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7C77C6C412; Tue, 21 Nov 2017 16:42:52 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E56E6C435 for ; Tue, 21 Nov 2017 16:42:51 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:13 +0100 Message-Id: <20171121164231.15008-4-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 03/21] 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.27]); Tue, 21 Nov 2017 16:43:07 +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 20a4acd74..321ee6a0f 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") @@ -4016,7 +4017,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 */ @@ -4040,7 +4041,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 @@ -11481,7 +11483,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 cb8701dd2..9b88bf19d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1081,7 +1081,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 216a4bdfe..d534bc8ad 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9166,6 +9166,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 @@ -10314,7 +10322,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 c6ba4079d..b60c374d9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4049,6 +4049,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 Wed May 1 14:08:07 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 151128257815176.21343397066823; Tue, 21 Nov 2017 08:42:58 -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 46755FC7C4; Tue, 21 Nov 2017 16:42: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 2344361F31; Tue, 21 Nov 2017 16:42:56 +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 E55504A469; Tue, 21 Nov 2017 16:42: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 vALGgsO3025783 for ; Tue, 21 Nov 2017 11:42:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 905D06C412; Tue, 21 Nov 2017 16:42:54 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CAF56C435 for ; Tue, 21 Nov 2017 16:42:52 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:14 +0100 Message-Id: <20171121164231.15008-5-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 04/21] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Nov 2017 16:42:56 +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 321ee6a0f..e4c537136 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11495,8 +11495,7 @@ virDomainChrDefaultTargetType(int devtype) } =20 static int -virDomainChrTargetTypeFromString(virDomainChrDefPtr def, - int devtype, +virDomainChrTargetTypeFromString(int devtype, const char *targetType) { int ret =3D -1; @@ -11524,8 +11523,6 @@ virDomainChrTargetTypeFromString(virDomainChrDefPtr= def, break; } =20 - def->targetTypeAttr =3D true; - return ret; } =20 @@ -11542,7 +11539,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"), @@ -16462,7 +16459,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; @@ -24023,7 +24020,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 9b88bf19d..5d4d17ed6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1207,7 +1207,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 3a95b6088..6d847de3a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -40,7 +40,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/= qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml index 759b84439..30989658f 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml @@ -47,7 +47,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 Wed May 1 14:08:07 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 1511282587836286.83385805140995; Tue, 21 Nov 2017 08:43:07 -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 4F57B6A7C7; Tue, 21 Nov 2017 16:43:04 +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 28EBC60010; Tue, 21 Nov 2017 16:43:04 +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 DD96E1800FC4; Tue, 21 Nov 2017 16:43: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 vALGgv0i025793 for ; Tue, 21 Nov 2017 11:42:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6BD786C412; Tue, 21 Nov 2017 16:42:57 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF39F6F432 for ; Tue, 21 Nov 2017 16:42:54 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:15 +0100 Message-Id: <20171121164231.15008-6-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 05/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Nov 2017 16:43:05 +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 e4c537136..224b88d9a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23933,38 +23933,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) { @@ -24036,6 +24013,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 Wed May 1 14:08:07 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 1511282588959997.9059191462297; Tue, 21 Nov 2017 08:43:08 -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 621996A7DF; Tue, 21 Nov 2017 16:43:05 +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 387AA5FFFE; Tue, 21 Nov 2017 16:43:05 +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 015943FCF9; Tue, 21 Nov 2017 16:43:05 +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 vALGh3rK025808 for ; Tue, 21 Nov 2017 11:43:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id BCA8E6C429; Tue, 21 Nov 2017 16:43:03 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CAC3F6F437 for ; Tue, 21 Nov 2017 16:42:57 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:16 +0100 Message-Id: <20171121164231.15008-7-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 06/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Nov 2017 16:43:05 +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; we should also report failure when virDomainChrSourceDefFormat() fails. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 224b88d9a..cb4ed6ef6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24025,8 +24025,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"), @@ -24044,7 +24042,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; @@ -24054,7 +24054,7 @@ virDomainChrDefFormat(virBufferPtr buf, 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 Wed May 1 14:08:07 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 1511282593103289.43616935090597; Tue, 21 Nov 2017 08:43:13 -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 F2A5664DB9; Tue, 21 Nov 2017 16:43:10 +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 C14BF17AD9; Tue, 21 Nov 2017 16:43:10 +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 8E75A3894; Tue, 21 Nov 2017 16:43:10 +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 vALGh8Zx025819 for ; Tue, 21 Nov 2017 11:43:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id AD53D6C412; Tue, 21 Nov 2017 16:43:08 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEDD96F433 for ; Tue, 21 Nov 2017 16:43:04 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:17 +0100 Message-Id: <20171121164231.15008-8-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 07/21] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Nov 2017 16:43:11 +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 cb4ed6ef6..cd9d384d3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23942,7 +23942,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", @@ -23989,28 +23989,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 Wed May 1 14:08:07 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 1511282595549562.792473339179; Tue, 21 Nov 2017 08:43:15 -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 86D4B550B0; Tue, 21 Nov 2017 16:43:13 +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 5E15161784; Tue, 21 Nov 2017 16:43: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 280453D383; Tue, 21 Nov 2017 16:43:13 +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 vALGhBeF025829 for ; Tue, 21 Nov 2017 11:43:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0AB256C412; Tue, 21 Nov 2017 16:43:11 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24AC76C43A for ; Tue, 21 Nov 2017 16:43:08 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:18 +0100 Message-Id: <20171121164231.15008-9-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 08/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 21 Nov 2017 16:43:13 +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 cd9d384d3..9d6e06025 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24007,14 +24007,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 Wed May 1 14:08:07 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 1511282598141186.73265343984838; Tue, 21 Nov 2017 08:43:18 -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 2EEC55FD67; Tue, 21 Nov 2017 16:43:16 +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 087B05FFFE; Tue, 21 Nov 2017 16:43:16 +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 C99343D386; Tue, 21 Nov 2017 16:43: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 vALGhDJG025840 for ; Tue, 21 Nov 2017 11:43:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 48C996F44B; Tue, 21 Nov 2017 16:43:13 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59E766F433 for ; Tue, 21 Nov 2017 16:43:11 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:19 +0100 Message-Id: <20171121164231.15008-10-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 09/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Nov 2017 16:43:16 +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 | 65 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 65 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d534bc8ad..86521d498 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10289,22 +10289,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: @@ -10313,13 +10300,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 b60c374d9..12b2a0bf6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3490,6 +3490,68 @@ 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", + _("Target type 'isa-serial' requires addres= s " + "of type 'isa'")); + 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", + _("Target type 'usb-serial' requires addres= s " + "of type 'usb'")); + 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", + _("Target type 'pci-serial' requires addres= s " + "of type 'pci'")); + 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) @@ -3497,6 +3559,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 Wed May 1 14:08:07 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 1511282599435647.8056036987838; Tue, 21 Nov 2017 08:43:19 -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 782E93E80E; Tue, 21 Nov 2017 16:43:17 +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 4251D5D97E; Tue, 21 Nov 2017 16:43:17 +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 068A2180474D; Tue, 21 Nov 2017 16:43:17 +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 vALGhGcG025850 for ; Tue, 21 Nov 2017 11:43:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 426366F43E; Tue, 21 Nov 2017 16:43:16 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 582406F433 for ; Tue, 21 Nov 2017 16:43:13 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:20 +0100 Message-Id: <20171121164231.15008-11-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 10/21] 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.25]); Tue, 21 Nov 2017 16:43:17 +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 --- docs/schemas/domaincommon.rng | 15 +++++++++ src/conf/domain_conf.c | 72 +++++++++++++++++++++++++++++++++++++++= +++- src/conf/domain_conf.h | 12 ++++++++ 3 files changed, 98 insertions(+), 1 deletion(-) 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 9d6e06025..140f478b0 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", @@ -11526,14 +11534,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; @@ -11547,6 +11583,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) { @@ -11635,6 +11689,7 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr de= f, ret =3D 0; error: VIR_FREE(targetType); + VIR_FREE(targetModel); VIR_FREE(addrStr); VIR_FREE(portStr); VIR_FREE(stateStr); @@ -24016,8 +24071,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 5d4d17ed6..3e74c635b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1112,6 +1112,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, @@ -1210,6 +1221,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 Wed May 1 14:08:07 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 1511282603204244.69296552897822; Tue, 21 Nov 2017 08:43:23 -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 3CA5C7EABE; Tue, 21 Nov 2017 16:43:21 +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 1488860010; Tue, 21 Nov 2017 16:43: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 C90EB1804751; Tue, 21 Nov 2017 16:43: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 vALGhJgZ025861 for ; Tue, 21 Nov 2017 11:43:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3C1746F433; Tue, 21 Nov 2017 16:43:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C3B36A857 for ; Tue, 21 Nov 2017 16:43:16 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:21 +0100 Message-Id: <20171121164231.15008-12-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 11/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 21 Nov 2017 16:43:21 +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 12b2a0bf6..32cb62fb9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4135,6 +4135,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 6d847de3a..df4c67bb4 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -40,7 +40,9 @@
- + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/= qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml index 30989658f..70c6a1a0f 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml @@ -47,7 +47,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 Wed May 1 14:08:07 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 1511282608242369.6824487350219; Tue, 21 Nov 2017 08:43:28 -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 6B6F372FEE; Tue, 21 Nov 2017 16:43:26 +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 498E060C9C; Tue, 21 Nov 2017 16:43: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 0E9EF3D387; Tue, 21 Nov 2017 16:43: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 vALGhP5e025892 for ; Tue, 21 Nov 2017 11:43:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E9986C429; Tue, 21 Nov 2017 16:43:25 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B5406F451 for ; Tue, 21 Nov 2017 16:43:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:22 +0100 Message-Id: <20171121164231.15008-13-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 12/21] 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Nov 2017 16:43:26 +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 --- src/libvirt_private.syms | 2 ++ src/qemu/qemu_domain.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d3ca6b2ec..0fb7d0e81 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 32cb62fb9..06ce382fa 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3538,6 +3538,43 @@ 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: + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires " + "target type 'isa'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel)); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires " + "target type 'usb'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel)); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires " + "target type 'pci'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel)); + 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 Wed May 1 14:08:07 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 1511282611850285.5818416064925; Tue, 21 Nov 2017 08:43:31 -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 364406869A; Tue, 21 Nov 2017 16:43: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 042EA5D9CD; Tue, 21 Nov 2017 16:43: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 BCAA71800C87; Tue, 21 Nov 2017 16:43:28 +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 vALGhRGa025915 for ; Tue, 21 Nov 2017 11:43:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6862D6C429; Tue, 21 Nov 2017 16:43:27 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 713C66F7E4 for ; Tue, 21 Nov 2017 16:43:25 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:23 +0100 Message-Id: <20171121164231.15008-14-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 13/21] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Nov 2017 16:43:29 +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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 86521d498..d49183931 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10282,8 +10282,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")); @@ -10291,10 +10291,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")); @@ -10302,8 +10302,8 @@ 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 @@ -10314,7 +10314,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } =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 Wed May 1 14:08:07 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 1511282614149379.3021502390379; Tue, 21 Nov 2017 08:43:34 -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 768776869E; Tue, 21 Nov 2017 16:43:31 +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 4DE1F5EE1E; Tue, 21 Nov 2017 16:43:31 +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 18F353D389; Tue, 21 Nov 2017 16:43:31 +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 vALGhUxo025947 for ; Tue, 21 Nov 2017 11:43:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A9D76A857; Tue, 21 Nov 2017 16:43:30 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 787D06F7E2 for ; Tue, 21 Nov 2017 16:43:27 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:24 +0100 Message-Id: <20171121164231.15008-15-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 14/21] conf: Shorten names in virDomainChrSerialTarget enumeration 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.27]); Tue, 21 Nov 2017 16:43:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that the target type is no longer formatted on the QEMU command line, we don't need the values to match the QEMU device names any longer, so we can shorten the names and reduce redundancy by dropping the -serial suffix: this also has the nice side-effect that target type and address type will now match. We still need to parse the old names, and format them when preparing a migratable XML, to preserve backwards compatibility. Signed-off-by: Andrea Bolognani --- docs/formatdomain.html.in | 10 +++--- docs/schemas/domaincommon.rng | 4 +++ src/conf/domain_conf.c | 39 ++++++++++++++++++= +--- .../qemuargv2xml-console-compat.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml | 2 +- .../qemuargv2xmldata/qemuargv2xml-serial-file.xml | 2 +- .../qemuargv2xmldata/qemuargv2xml-serial-many.xml | 4 +-- tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml | 2 +- .../qemuargv2xml-serial-tcp-telnet.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml | 4 +-- .../qemuargv2xmldata/qemuargv2xml-serial-unix.xml | 2 +- tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml | 2 +- ...otplug-console-compat-2-live+console-virtio.xml | 6 ++-- .../qemuhotplug-console-compat-2-live.xml | 6 ++-- ...muxml2argv-serial-tcp-tlsx509-chardev-notls.xml | 4 +-- .../qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 4 +-- .../qemuxml2xmlout-aarch64-pci-serial.xml | 2 +- .../qemuxml2xmlout-bios-nvram-os-interleave.xml | 2 +- .../qemuxml2xmlout-chardev-label.xml | 4 +-- .../qemuxml2xmlout-console-compat-auto.xml | 2 +- .../qemuxml2xmlout-console-compat.xml | 2 +- .../qemuxml2xmlout-console-compat2.xml | 2 +- .../qemuxml2xmlout-console-virtio-many.xml | 2 +- .../qemuxml2xmlout-interface-driver.xml | 2 +- .../qemuxml2xmlout-interface-server.xml | 4 +-- .../qemuxml2xmlout-net-bandwidth.xml | 2 +- .../qemuxml2xmlout-net-bandwidth2.xml | 2 +- .../qemuxml2xmlout-net-coalesce.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml | 2 +- .../qemuxml2xmlout-panic-pseries.xml | 2 +- .../qemuxml2xmlout-pci-serial-dev-chardev.xml | 2 +- .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 2 +- .../qemuxml2xmlout-pseries-cpu-compat.xml | 2 +- .../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 +- .../qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-serial-target-port-auto.xml | 6 ++-- .../qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml | 4 +-- .../qemuxml2xmlout-tap-vhost-incorrect.xml | 2 +- .../qemuxml2xmlout-tap-vhost.xml | 2 +- .../qemuxml2xmlout-vhost_queues.xml | 2 +- 45 files changed, 99 insertions(+), 64 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4bc88cfc5..2edc61a01 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6530,13 +6530,13 @@ qemu-kvm -net nic,model=3D? /dev/null 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 + which has three choices for its value, one is isa, + then usb and last one is pci. + If type is missing, isa will be used by + default. For usb 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 + Similarly, pci 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. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fbba092d1..93beabc5e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3582,6 +3582,10 @@ + isa + usb + pci + isa-serial usb-serial pci-serial diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 140f478b0..0d8c88db9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -449,9 +449,10 @@ VIR_ENUM_IMPL(virDomainChrDeviceState, VIR_DOMAIN_CHR_= DEVICE_STATE_LAST, VIR_ENUM_IMPL(virDomainChrSerialTarget, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST, "none", - "isa-serial", - "usb-serial", - "pci-serial") + "isa", + "usb", + "pci", +); =20 VIR_ENUM_IMPL(virDomainChrChannelTarget, VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST, @@ -11511,6 +11512,17 @@ virDomainChrTargetTypeFromString(int devtype, if (!targetType) return virDomainChrDefaultTargetType(devtype); =20 + /* Perform conversion between the legacy values for targetType, which + * are still accepted for backwards compatibility reasons, and the + * new values expected by virDomainChrSerialTargetTypeFromString() */ + if (STREQ(targetType, "isa-serial")) { + targetType =3D "isa"; + } else if (STREQ(targetType, "usb-serial")) { + targetType =3D "usb"; + } else if (STREQ(targetType, "pci-serial")) { + targetType =3D "pci"; + } + switch ((virDomainChrDeviceType) devtype) { case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: ret =3D virDomainChrChannelTargetTypeFromString(targetType); @@ -24066,8 +24078,27 @@ virDomainChrTargetDefFormat(virBufferPtr buf, =20 if (def->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { virBufferAsprintf(buf, - "type=3D'%s' ", + "type=3D'%s", targetType); + + /* When formatting a migratable XML, some target types need to + * be converted by appending "-serial" to their names, so that + * migration to older libvirt versions to work */ + if ((flags & VIR_DOMAIN_XML_MIGRATABLE)) { + switch ((virDomainChrSerialTargetType) def->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: + virBufferAddLit(buf, "-serial"); + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* No conversion necessary */ + break; + } + } + + virBufferAddLit(buf, "' "); } =20 virBufferAsprintf(buf, diff --git a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml b/tests= /qemuargv2xmldata/qemuargv2xml-console-compat.xml index cba43ca45..1b0b82faa 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 e9998d554..038ac7b64 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 0e9dfe578..4735c2f6c 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 05374b38d..fd24305d3 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml @@ -28,13 +28,13 @@
- + - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml b/tests/qem= uargv2xmldata/qemuargv2xml-serial-pty.xml index cba43ca45..1b0b82faa 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 1ac12440e..3d7cb35b2 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 c10cee903..11b59f757 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 fd56dda84..5dd2af063 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml @@ -30,13 +30,13 @@ - + - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml b/tests/qe= muargv2xmldata/qemuargv2xml-serial-unix.xml index 70b192f67..76cd70215 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 630844ea0..8bda30472 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 abe68a0a0..be42dbed6 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,13 +68,13 @@
- + - + @@ -82,7 +82,7 @@ - + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live= .xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml index 45161e1e2..ba08844d0 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml @@ -68,13 +68,13 @@
- + - + @@ -82,7 +82,7 @@ - + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev= -notls.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev= -notls.xml index 89dc9e6e1..418d12c05 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.= xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.= xml @@ -29,14 +29,14 @@ - + - + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml b/tests/q= emuxml2argvdata/qemuxml2argv-user-aliases.xml index 52132a82d..b22e63915 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml @@ -110,12 +110,12 @@
- + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml index b02a5a7db..354f7acf2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml @@ -34,7 +34,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interlea= ve.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.x= ml index b6d7a6636..ffcf7641c 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 7d5bbdd0a..23c3aedb2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml @@ -25,7 +25,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml index 267b253b1..2b07ec5e3 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 6a52800a3..f5c7078a4 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 8c7bbb768..1edc14c05 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 1a22b78b8..9c09d32d2 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 5be590e75..c5acda87b 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 049b1472a..b0fd01501 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml @@ -104,12 +104,12 @@
- + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml index 4ec77d154..9a95ba2f8 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 ee65c3a5b..b7a017a5b 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 56792b999..c7075bfff 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 fc7b2e39a..8016846eb 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 496df0696..eeda93155 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-pci-serial-dev-chardev= .xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml index 8f77ef043..dd0ef800e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml @@ -28,7 +28,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-pow= er9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9= .xml index 9d4c5efe6..ced122581 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 6059859ab..f030f0011 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 f3216523e..98d7a2707 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 496df0696..eeda93155 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 496df0696..eeda93155 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 2437fdec4..4b9b8e413 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 e1d5cb9d7..6fc74743b 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 ff92435af..f7adcb7e1 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 fded758ea..37abc239e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml @@ -27,17 +27,17 @@ - + - + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-cha= rdev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chard= ev.xml index 76d894820..07a2e9b31 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml @@ -29,14 +29,14 @@ - + - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml index df4c67bb4..37ed82209 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -40,7 +40,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/= qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml index 70c6a1a0f..a972a9c81 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml @@ -47,7 +47,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml b/tes= ts/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml index 49a7b550b..60558b08f 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 Wed May 1 14:08:07 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 1511282617513247.38357023557592; Tue, 21 Nov 2017 08:43: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 2635B5D9E5; Tue, 21 Nov 2017 16:43:35 +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 015F16001A; Tue, 21 Nov 2017 16:43:35 +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 A195D1800C87; Tue, 21 Nov 2017 16:43:34 +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 vALGhX4U025980 for ; Tue, 21 Nov 2017 11:43:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 479016F44C; Tue, 21 Nov 2017 16:43:33 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09BC06C435 for ; Tue, 21 Nov 2017 16:43:30 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:25 +0100 Message-Id: <20171121164231.15008-16-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 15/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Nov 2017 16:43:35 +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 diff -w'. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1511421 Signed-off-by: Andrea Bolognani --- docs/formatdomain.html.in | 11 ++-- docs/schemas/domaincommon.rng | 2 + src/conf/domain_conf.c | 4 ++ src/conf/domain_conf.h | 2 + src/qemu/qemu_command.c | 74 ++++++++++--------= ---- src/qemu/qemu_domain.c | 74 ++++++++++++++++++= ---- 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, 301 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 2edc61a01..92622d031 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6530,10 +6530,13 @@ qemu-kvm -net nic,model=3D? /dev/null 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, - then usb and last one is pci. - If type is missing, isa will be used by - default. For usb an optional sub-element + which can be used to pick between isa, usb, + pci and, since 3.10.0, + spapr-vio. + Some values are not compatible with all architecture and machine typ= es; + if the value is missing altogether, libvirt will try to pick an + appropriate default. + For usb an optional sub-element <address/> with type=3D'usb' can tie= the device to a particular controller, docu= mented above. Similarly, pci can be used to attach the device to diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 93beabc5e..b7a13660d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3585,6 +3585,7 @@ isa usb pci + spapr-vio isa-serial usb-serial @@ -3600,6 +3601,7 @@ isa-serial usb-serial pci-serial + spapr-vty diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0d8c88db9..d90acd31e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -452,6 +452,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "isa", "usb", "pci", + "spapr-vio", ); =20 VIR_ENUM_IMPL(virDomainChrChannelTarget, @@ -479,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, @@ -4051,6 +4053,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. @@ -24091,6 +24094,7 @@ virDomainChrTargetDefFormat(virBufferPtr buf, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: virBufferAddLit(buf, "-serial"); break; + 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: /* No conversion necessary */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3e74c635b..dc376de49 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1085,6 +1085,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; @@ -1117,6 +1118,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 d49183931..d1dd60d8f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10269,55 +10269,49 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, { virBuffer cmd =3D VIR_BUFFER_INITIALIZER; =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); + 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 bin= ary")); + goto error; } - } 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")); - goto error; - } - break; + break; =20 - case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: - break; + 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_PCI_SERIAL: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("pci-serial is not supported with this QEMU b= inary")); + goto error; + } + break; =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 type for serial device")); + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spapr-vty not supported in this QEMU binary"= )); 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_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 type 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 06ce382fa..785a93207 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3491,8 +3491,7 @@ qemuDomainChrSourceDefValidate(const virDomainChrSour= ceDef *def) =20 =20 static int -qemuDomainChrTargetDefValidate(const virDomainDef *def, - const virDomainChrDef *chr) +qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) { switch ((virDomainChrDeviceType) chr->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: @@ -3500,11 +3499,6 @@ qemuDomainChrTargetDefValidate(const virDomainDef *d= ef, /* 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", @@ -3534,6 +3528,16 @@ qemuDomainChrTargetDefValidate(const virDomainDef *d= ef, } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + if (chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + chr->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVI= O) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target type 'spapr-vio' requires address= " + "of type 'spapr-vio'")); + return -1; + } + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: break; @@ -3571,6 +3575,16 @@ qemuDomainChrTargetDefValidate(const virDomainDef *d= ef, } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPA= PR_VIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires " + "target type 'spapr-vio'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel)); + return -1; + } + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -3596,7 +3610,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 && @@ -3606,6 +3620,17 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, return -1; } =20 + if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VI= O || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_= VTY) && + !qemuDomainIsPSeries(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Serial devices with target type 'spapr-vio' and " + "target model 'spapr-vty' are only supported on " + "pSeries guests")); + return -1; + } + return 0; } =20 @@ -4165,10 +4190,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 @@ -4185,6 +4207,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 */ @@ -5090,6 +5115,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..568686dbc --- /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..4415ef80d --- /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..b5fabcdf7 --- /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 781c649bf..4196e05a7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1872,6 +1872,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 eeda93155..7fd8a541b 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 eeda93155..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 ced122581..a59dc3bc5 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 f030f0011..1996a69d9 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 98d7a2707..fe8c67c96 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 eeda93155..7fd8a541b 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 eeda93155..7fd8a541b 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 eeda93155..017e0e8fb 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 99d831c32..9110943b4 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -766,6 +766,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 Wed May 1 14:08:07 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 1511282618951826.0498742793255; Tue, 21 Nov 2017 08:43:38 -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 02B333B73C; Tue, 21 Nov 2017 16:43:37 +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 CD20A61F32; Tue, 21 Nov 2017 16:43: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 9870F180474A; Tue, 21 Nov 2017 16:43: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 vALGhZmr026020 for ; Tue, 21 Nov 2017 11:43:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 998796F437; Tue, 21 Nov 2017 16:43:35 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A485B6C429 for ; Tue, 21 Nov 2017 16:43:33 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:26 +0100 Message-Id: <20171121164231.15008-17-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 16/21] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Nov 2017 16:43:37 +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 d1dd60d8f..96ff082d3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9150,15 +9150,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 4196e05a7..bec7036b7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1881,6 +1881,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..4d740e254 --- /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..84ee2e1fe --- /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 9110943b4..ba10cbe64 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -775,6 +775,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 Wed May 1 14:08:07 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 1511282624590391.6981530142672; Tue, 21 Nov 2017 08:43: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 D9D9081DEB; Tue, 21 Nov 2017 16:43: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 AE93A5D975; Tue, 21 Nov 2017 16:43:41 +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 6F5121804751; Tue, 21 Nov 2017 16:43:41 +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 vALGhe7o026044 for ; Tue, 21 Nov 2017 11:43:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B3B06C43E; Tue, 21 Nov 2017 16:43:40 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F16EB6F432 for ; Tue, 21 Nov 2017 16:43:35 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:27 +0100 Message-Id: <20171121164231.15008-18-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 17/21] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Nov 2017 16:43:42 +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 --- docs/formatdomain.html.in | 2 +- docs/schemas/domaincommon.rng | 2 + src/conf/domain_conf.c | 4 ++ src/conf/domain_conf.h | 2 + src/qemu/qemu_command.c | 8 +++- src/qemu/qemu_domain.c | 37 ++++++++++++++++++ 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, 507 insertions(+), 4 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 92622d031..1efded6be 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6532,7 +6532,7 @@ qemu-kvm -net nic,model=3D? /dev/null type attribute since 1.0.2 which can be used to pick between isa, usb, pci and, since 3.10.0, - spapr-vio. + spapr-vio and system. Some values are not compatible with all architecture and machine typ= es; if the value is missing altogether, libvirt will try to pick an appropriate default. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b7a13660d..949ad38ac 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3586,6 +3586,7 @@ usb pci spapr-vio + system isa-serial usb-serial @@ -3602,6 +3603,7 @@ usb-serial pci-serial spapr-vty + pl011 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d90acd31e..7b35fbd3d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -453,6 +453,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "usb", "pci", "spapr-vio", + "system", ); =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, @@ -4054,6 +4056,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. @@ -24095,6 +24098,7 @@ virDomainChrTargetDefFormat(virBufferPtr buf, virBufferAddLit(buf, "-serial"); break; 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: /* No conversion necessary */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index dc376de49..59e292c9c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1086,6 +1086,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; @@ -1119,6 +1120,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 96ff082d3..e6961d7ec 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9151,10 +9151,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 @@ -10288,6 +10291,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } 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 785a93207..2b7a7dfc9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3538,6 +3538,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; @@ -3585,6 +3595,16 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef= *chr) } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYS= TEM) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires " + "target type 'system'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel)); + return -1; + } + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -3631,6 +3651,17 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, return -1; } =20 + if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011)= && + !qemuDomainIsVirt(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Serial devices with target type 'system' and " + "target model 'pl011' are only supported on " + "mach-virt guests")); + return -1; + } + return 0; } =20 @@ -4191,6 +4222,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 @@ -4210,6 +4243,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 */ @@ -5126,6 +5162,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..0b9acc45a --- /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 bec7036b7..258ca72d4 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1895,6 +1895,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..112a72e56 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..7b9bef7a0 --- /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..e73e3b105 --- /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..a33c39cca --- /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 ba10cbe64..f2b540f63 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -788,6 +788,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 Wed May 1 14:08:07 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 1511282631531644.6795110727508; Tue, 21 Nov 2017 08:43:51 -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 87FFD2DD788; Tue, 21 Nov 2017 16:43:49 +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 564715D977; Tue, 21 Nov 2017 16:43:49 +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 283E41802121; Tue, 21 Nov 2017 16:43:48 +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 vALGhkFn026063 for ; Tue, 21 Nov 2017 11:43:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D5406F444; Tue, 21 Nov 2017 16:43:46 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 534606C435 for ; Tue, 21 Nov 2017 16:43:40 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:28 +0100 Message-Id: <20171121164231.15008-19-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 18/21] 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.29]); Tue, 21 Nov 2017 16:43:50 +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: Pavel Hrdina --- docs/formatdomain.html.in | 2 +- docs/schemas/domaincommon.rng | 3 ++ src/conf/domain_conf.c | 5 ++++ src/conf/domain_conf.h | 3 ++ src/qemu/qemu_command.c | 16 ++++++++++ src/qemu/qemu_domain.c | 30 +++++++++++++++++++ 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, 295 insertions(+), 1 deletion(-) 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 1efded6be..fd85b7633 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6532,7 +6532,7 @@ qemu-kvm -net nic,model=3D? /dev/null type attribute since 1.0.2 which can be used to pick between isa, usb, pci and, since 3.10.0, - spapr-vio and system. + spapr-vio, system and sclp. Some values are not compatible with all architecture and machine typ= es; if the value is missing altogether, libvirt will try to pick an appropriate default. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 949ad38ac..fe90c78a8 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3587,6 +3587,7 @@ pci spapr-vio system + sclp isa-serial usb-serial @@ -3604,6 +3605,8 @@ pci-serial spapr-vty pl011 + sclpconsole + sclplmconsole diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7b35fbd3d..1dcd0e91a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -454,6 +454,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "pci", "spapr-vio", "system", + "sclp", ); =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, @@ -4057,6 +4060,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. @@ -24099,6 +24103,7 @@ virDomainChrTargetDefFormat(virBufferPtr buf, break; 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: /* No conversion necessary */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 59e292c9c..b06f40ab8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1087,6 +1087,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; @@ -1121,6 +1122,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 e6961d7ec..79bae06d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10291,6 +10291,22 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPCONSOLE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("sclpconsole not supported in this QEMU binar= y")); + return -1; + } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPLMCONSOLE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("sclplmconsole not supported in this QEMU bin= ary")); + return -1; + } + 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/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2b7a7dfc9..21eb371e7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3539,6 +3539,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 " @@ -3605,6 +3606,17 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef= *chr) } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + if (chr->targetType !=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCL= P) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target model '%s' requires " + "target type 'sclp'"), + virDomainChrSerialTargetModelTypeToString(c= hr->targetModel)); + return -1; + } + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -3662,6 +3674,18 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, return -1; } =20 + if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCO= NSOLE || + dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLM= CONSOLE) && + !ARCH_IS_S390(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Serial devices with target type 'sclp' and " + "target model 'sclpconsole' or 'sclplmconsole' " + "are only supported on s390 and s390x guests")); + return -1; + } + return 0; } =20 @@ -4224,6 +4248,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 @@ -4246,6 +4272,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 */ @@ -5169,6 +5198,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..d3bcef95a --- /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 258ca72d4..ed1c437b8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2046,6 +2046,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..9c7eefd13 --- /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..f8f5dec4a --- /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..98395c2d2 --- /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 f2b540f63..40b7467a9 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1155,6 +1155,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 Wed May 1 14:08:07 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 1511282636021840.4872633405696; Tue, 21 Nov 2017 08:43:56 -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 6B13E6016B; Tue, 21 Nov 2017 16:43:53 +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 45F9761F41; Tue, 21 Nov 2017 16:43: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 12C013D38B; Tue, 21 Nov 2017 16:43: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 vALGhpl7026125 for ; Tue, 21 Nov 2017 11:43:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id E0D617D13C; Tue, 21 Nov 2017 16:43:51 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAD356F45B for ; Tue, 21 Nov 2017 16:43:46 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:29 +0100 Message-Id: <20171121164231.15008-20-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 19/21] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Nov 2017 16:43:53 +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 1dcd0e91a..c4497ab0f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3980,7 +3980,8 @@ virDomainDefPostParseMemory(virDomainDefPtr def, =20 =20 static int -virDomainDefAddConsoleCompat(virDomainDefPtr def) +virDomainDefAddConsoleCompat(virDomainDefPtr def, + unsigned int parseFlags ATTRIBUTE_UNUSED) { size_t i; =20 @@ -4941,7 +4942,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) { @@ -22016,9 +22017,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 b06f40ab8..0c2daa81a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2949,7 +2949,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 Wed May 1 14:08:07 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 1511282639520160.76281273345933; Tue, 21 Nov 2017 08:43:59 -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 8FBB86869D; Tue, 21 Nov 2017 16:43: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 5509263775; Tue, 21 Nov 2017 16:43: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 127704BB79; Tue, 21 Nov 2017 16:43: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 vALGhtFd026155 for ; Tue, 21 Nov 2017 11:43:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5D8FA6F442; Tue, 21 Nov 2017 16:43:55 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 756286F7EE for ; Tue, 21 Nov 2017 16:43:52 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:30 +0100 Message-Id: <20171121164231.15008-21-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 20/21] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Nov 2017 16:43:58 +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 --- 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 c4497ab0f..027e91bb6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3979,9 +3979,39 @@ virDomainDefPostParseMemory(virDomainDefPtr def, } =20 =20 +static void +virDomainChrConsoleTargetTypeToSerial(virDomainChrConsoleTargetType type, + int *retType, int *retModel) +{ + switch (type) { + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: + *retType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + *retModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE; + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: + *retType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + *retModel =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: + *retType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + *retModel =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 @@ -3998,6 +4028,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, @@ -4014,7 +4048,9 @@ 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_TARGE= T_TYPE_SCLP && + (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 @@ -4027,6 +4063,8 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, =20 /* create the serial port definition from the console definition */ if (def->nserials =3D=3D 0) { + virDomainChrConsoleTargetType type =3D def->consoles[0]->targe= tType; + if (VIR_APPEND_ELEMENT(def->serials, def->nserials, def->consoles[0]) < 0) @@ -4034,7 +4072,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(type, + &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 ed1c437b8..a002bdf2f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2062,6 +2062,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 Wed May 1 14:08:07 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 1511282649369490.5461706098647; Tue, 21 Nov 2017 08:44:09 -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 5A53FC059B6F; Tue, 21 Nov 2017 16:44: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 2B74261F40; Tue, 21 Nov 2017 16:44:07 +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 E1B951800BDA; Tue, 21 Nov 2017 16:44: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 vALGi5OZ026198 for ; Tue, 21 Nov 2017 11:44:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4E8CB6F437; Tue, 21 Nov 2017 16:44:05 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5978A6F7EA for ; Tue, 21 Nov 2017 16:43:55 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 21 Nov 2017 17:42:31 +0100 Message-Id: <20171121164231.15008-22-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 21/21] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 21 Nov 2017 16:44:07 +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 21eb371e7..49a613675 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4224,13 +4224,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..677dd11c1 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 f8f5dec4a..98395c2d2 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 Wed May 1 14:08:07 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 1511364423807251.11306173858566; Wed, 22 Nov 2017 07:27:03 -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 3109880473; Wed, 22 Nov 2017 15:27:02 +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 0BF815D960; Wed, 22 Nov 2017 15:27:02 +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 C30241800BDE; Wed, 22 Nov 2017 15:27:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMFOOj2022373 for ; Wed, 22 Nov 2017 10:24:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 539E462676; Wed, 22 Nov 2017 15:24:24 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.40.205.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D93F62677 for ; Wed, 22 Nov 2017 15:24:18 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 16:24:07 +0100 Message-Id: <20171122152407.25200-1-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 22/21] 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.28]); Wed, 22 Nov 2017 15:27:02 +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 --- docs/formatdomain.html.in | 230 ++++++++++++++++++++++++++++++++++--------= ---- 1 file changed, 172 insertions(+), 58 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fd85b7633..2abbadd53 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6518,80 +6518,81 @@ 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' port=3D'0'>
+      <model name=3D'usb-serial'/>
+    </target>
+    <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 can be used to pick between isa, usb, - pci and, since 3.10.0, - spapr-vio, system and sclp. - Some values are not compatible with all architecture and machine typ= es; - if the value is missing altogether, libvirt will try to pick an - appropriate default. - For usb an optional sub-element - <address/> with type=3D'usb' can tie= the - device to a particular controller, docu= mented above. - Similarly, pci 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 which indicates what bus the + serial device is connected to: + since 3.10.0, valid values are + isa, usb, pci, + spapr-vio, system and sclp; f= or + backwards compatibility, isa-serial, + usb-serial and pci-serial (available + since 1.0.2) are accepted as well.

=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: + Since 3.10.0, the target + element can have an optional model subelement, whose + name attribute can be used to choose the concrete, + hypervisor-specific device name: valid values are + isa-serial, usb-serial, + pci-serial, spapr-vty, pl011, + sclpconsole and sclplmconsole.

=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 -
  • -
+

+ Some of the values listed above are not compatible with all + architecture and machine types, and if the value is missing altogeth= er, + libvirt will try to pick an appropriate default. In general, it's a + good idea to specify neither the target type nor the target model, + leave the task of choosing values up to libvirt, and don't change the + values afterward. +

=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 + Some of the types support configuring the guest-visible device + address as documented above. + 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'/>
@@ -6600,21 +6601,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 va= lues + for the type attribute are serial, + virtio, xen, lxc, + uml and openvz. The sclp and + sclplm values are supported for compatibility reasons b= ut + should not be used for new guests: use the sclpconsole + and sclplmconsole target models, respectively, with the + serial element instead. +

+ +

+ 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 Wed May 1 14:08:07 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 1511364428552837.0563163938986; Wed, 22 Nov 2017 07:27:08 -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 7C5734DD7C; Wed, 22 Nov 2017 15:27:07 +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 574E062671; Wed, 22 Nov 2017 15:27:07 +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 22FD54BB79; Wed, 22 Nov 2017 15:27:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMFOqh4022400 for ; Wed, 22 Nov 2017 10:24:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9215260FA2; Wed, 22 Nov 2017 15:24:52 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.40.205.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2C6560F89 for ; Wed, 22 Nov 2017 15:24:49 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 16:24:39 +0100 Message-Id: <20171122152439.25262-1-abologna@redhat.com> In-Reply-To: <20171121164231.15008-1-abologna@redhat.com> References: <20171121164231.15008-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 23/21] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Nov 2017 15:27:07 +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 5eb0b79d6..abb9b5d0d 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -135,6 +135,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