From nobody Thu May 15 08:52:10 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 1511735266453865.0875791761214; Sun, 26 Nov 2017 14:27:46 -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 2ADBF81E09; Sun, 26 Nov 2017 22:27:45 +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 024415D979; Sun, 26 Nov 2017 22:27: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 A108E1802121; Sun, 26 Nov 2017 22:27:44 +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 vAQMQdTp028501 for ; Sun, 26 Nov 2017 17:26:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id E24FB18ED1; Sun, 26 Nov 2017 22:26:39 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-63.brq.redhat.com [10.40.204.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17B6660BE9 for ; Sun, 26 Nov 2017 22:26:38 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Sun, 26 Nov 2017 23:25:44 +0100 Message-Id: <20171126222549.13681-24-abologna@redhat.com> In-Reply-To: <20171126222549.13681-1-abologna@redhat.com> References: <20171126222549.13681-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 23/28] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 26 Nov 2017 22:27:45 +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 --- This patch might need to be dropped. See https://www.redhat.com/archives/libvir-list/2017-November/msg00996.html src/conf/domain_conf.c | 46 ++++++++++++++++++= ++-- .../qemuxml2argv-s390-console2serial.args | 22 +++++++++++ .../qemuxml2argv-s390-console2serial.xml | 19 +++++++++ tests/qemuxml2argvtest.c | 6 +++ 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial= .args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial= .xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 792d9bef4..29afcb6c5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3986,9 +3986,40 @@ virDomainDefPostParseMemory(virDomainDefPtr def, } =20 =20 +static void +virDomainChrConsoleTargetTypeToSerial(virDomainChrConsoleTargetType type, + int *targetType, + int *targetModel) +{ + switch (type) { + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: + *targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + *targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE; + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: + *targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + *targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE; + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST: + *targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + *targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE; + break; + } +} + + static int virDomainDefAddConsoleCompat(virDomainDefPtr def, - unsigned int parseFlags ATTRIBUTE_UNUSED) + unsigned int parseFlags) { size_t i; =20 @@ -4005,6 +4036,10 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, * * We then fill def->consoles[0] with a stub just so we get sequencing * correct for consoles > 0 + * + * sclp/sclplm consoles (in s390 and s390x guests) are converted to se= rial + * only when we can update the ABI of the guest, to avoid breaking + * migrations to old libvirt. */ =20 /* Only the first console (if there are any) can be of type serial, @@ -4021,7 +4056,10 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, } if (def->nconsoles > 0 && def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && (def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_SERIAL || - def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_NONE)) { + def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET= _TYPE_NONE || + ((def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARG= ET_TYPE_SCLP || + def->consoles[0]->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARG= ET_TYPE_SCLPLM) && + (parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)))) { =20 /* If there isn't a corresponding serial port: * - create one and set, the console to be an alias for it @@ -4041,7 +4079,9 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def, =20 /* modify it to be a serial port */ def->serials[0]->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SER= IAL; - def->serials[0]->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_T= YPE_NONE; + virDomainChrConsoleTargetTypeToSerial(def->serials[0]->targetT= ype, + &def->serials[0]->target= Type, + &def->serials[0]->target= Model); def->serials[0]->target.port =3D 0; } else { /* if the console source doesn't match */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.args b= /tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.args new file mode 100644 index 000000000..20968f794 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.args @@ -0,0 +1,22 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-chardev pty,id=3Dcharserial0 \ +-device sclpconsole,chardev=3Dcharserial0,id=3Dserial0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml b/= tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml new file mode 100644 index 000000000..5f02ec8a0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + /usr/bin/qemu-system-s390x + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d9ed8af79..9480f865f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2067,6 +2067,12 @@ mymain(void) QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_SCLPCONSOLE); + DO_TEST_FULL("s390-console2serial", NULL, -1, 0, + VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, GIC_NONE, + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_DEVICE_SCLPCONSOLE); =20 DO_TEST("ppc-dtb", QEMU_CAPS_KVM, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list