From nobody Thu May 15 08:46:28 2025 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 1510746647926977.7983340441041; Wed, 15 Nov 2017 03:50:47 -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 8F2B22CE95D; Wed, 15 Nov 2017 11:50:45 +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 686847D145; Wed, 15 Nov 2017 11:50:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 312CB3D391; Wed, 15 Nov 2017 11:50:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAFBoae7022517 for ; Wed, 15 Nov 2017 06:50:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5E0A9121F28; Wed, 15 Nov 2017 11:50:36 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.219]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D62C5121F22 for ; Wed, 15 Nov 2017 11:50:35 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 15 Nov 2017 12:50:15 +0100 Message-Id: <20171115115017.10092-13-abologna@redhat.com> In-Reply-To: <20171115115017.10092-1-abologna@redhat.com> References: <20171115115017.10092-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/14] 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 15 Nov 2017 11:50:46 +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: Bjoern Walk --- src/conf/domain_conf.c | 39 ++++++++++++++++++= ++-- .../qemuxml2argv-s390-console2serial.args | 22 ++++++++++++ .../qemuxml2argv-s390-console2serial.xml | 19 +++++++++++ tests/qemuxml2argvtest.c | 6 ++++ 4 files changed, 83 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 9a3cdc777..14b611602 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3966,9 +3966,35 @@ virDomainDefPostParseMemory(virDomainDefPtr def, } =20 =20 +static virDomainChrSerialTargetType +virDomainChrConsoleTargetTypeToSerial(virDomainChrConsoleTargetType type) +{ + switch (type) { + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM; + + 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: + /* Return the default at the end, to please strict compilers. */ + break; + } + + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; +} + + static int virDomainDefAddConsoleCompat(virDomainDefPtr def, - unsigned int parseFlags ATTRIBUTE_UNUSED) + unsigned int parseFlags) { size_t i; =20 @@ -3985,6 +4011,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, @@ -4001,7 +4031,10 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, } if (def->nconsoles > 0 && def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && (def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_SERIAL || - def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_NONE)) { + def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_NONE || + ((def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARG= ET_TYPE_SCLP || + def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARG= ET_TYPE_SCLPLM) && + (parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)))) { =20 /* If there isn't a corresponding serial port: * - create one and set, the console to be an alias for it @@ -4021,7 +4054,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_NONE; + def->serials[0]->targetType =3D virDomainChrConsoleTargetTypeT= oSerial(def->serials[0]->targetType); 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 a280a8a85..6cc7731a7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2061,6 +2061,12 @@ mymain(void) QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_SCLP_S390); + 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_SCLP_S390); =20 DO_TEST("ppc-dtb", QEMU_CAPS_KVM, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list