From nobody Wed May 14 06:28:48 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15270923064631000.1962643409288; Wed, 23 May 2018 09:18:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C578A11B265; Wed, 23 May 2018 16:18:24 +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 8AE482A17A; Wed, 23 May 2018 16:18:24 +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 09C6C18033F1; Wed, 23 May 2018 16:18:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4NGIAPb015896 for ; Wed, 23 May 2018 12:18:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF5022026E0E; Wed, 23 May 2018 16:18:10 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-119.brq.redhat.com [10.40.204.119]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 179792026DFD for ; Wed, 23 May 2018 16:18:09 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 23 May 2018 18:17:58 +0200 Message-Id: <20180523161802.23266-3-abologna@redhat.com> In-Reply-To: <20180523161802.23266-1-abologna@redhat.com> References: <20180523161802.23266-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 2/6] conf: Tweak HPT parsing and formatting 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 23 May 2018 16:18:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This doesn't seem very useful at the moment, but it will make sense once we introduce another HPT-related setting. The output XML is decoupled from the input XML in preparation of future changes as well; while doing so, we can shave a few lines off the latter. This commit is best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 25 ++++++++++++--- src/qemu/qemu_command.c | 32 ++++++++++--------- tests/qemuxml2argvdata/pseries-features.xml | 14 ++------ tests/qemuxml2xmloutdata/pseries-features.xml | 29 ++++++++++++++++- 4 files changed, 68 insertions(+), 32 deletions(-) mode change 120000 =3D> 100644 tests/qemuxml2xmloutdata/pseries-features.x= ml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 355e497002..20b845f02a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27207,14 +27207,31 @@ virDomainDefFormatInternal(virDomainDefPtr def, virDomainIOAPICTypeToString(def->feature= s[i])); break; =20 - case VIR_DOMAIN_FEATURE_HPT: + case VIR_DOMAIN_FEATURE_HPT: { + bool hasResizing =3D def->hpt_resizing !=3D VIR_DOMAIN_HPT= _RESIZING_NONE; + char *resizing =3D NULL; + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON || - def->hpt_resizing =3D=3D VIR_DOMAIN_HPT_RESIZING_NONE) + !hasResizing) { break; + } + + if (hasResizing) { + if (virAsprintf(&resizing, " resizing=3D'%s'", + virDomainHPTResizingTypeToString(def->= hpt_resizing)) < 0) { + goto error; + } + } else { + if (VIR_STRDUP(resizing, "") < 0) + goto error; + } =20 - virBufferAsprintf(buf, "\n", - virDomainHPTResizingTypeToString(def->hp= t_resizing)); + virBufferAsprintf(buf, "\n", + resizing); + + VIR_FREE(resizing); break; + } =20 /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ddbde54a8c..b446a08613 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7173,24 +7173,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } =20 if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N) { - const char *str; =20 - if (def->hpt_resizing !=3D VIR_DOMAIN_HPT_RESIZING_NONE && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT= )) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("HTP resizing is not supported by this " - "QEMU binary")); - goto cleanup; - } + if (def->hpt_resizing !=3D VIR_DOMAIN_HPT_RESIZING_NONE) { + const char *str; =20 - str =3D virDomainHPTResizingTypeToString(def->hpt_resizing); - if (!str) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid setting for HPT resizing")); - goto cleanup; - } + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE= _HPT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("HTP resizing is not supported by this " + "QEMU binary")); + goto cleanup; + } + + str =3D virDomainHPTResizingTypeToString(def->hpt_resizing); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for HPT resizing")); + goto cleanup; + } =20 - virBufferAsprintf(&buf, ",resize-hpt=3D%s", str); + virBufferAsprintf(&buf, ",resize-hpt=3D%s", str); + } } =20 if (cpu && cpu->model && diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2ar= gvdata/pseries-features.xml index 5dd0dbd0be..5ef1a744c8 100644 --- a/tests/qemuxml2argvdata/pseries-features.xml +++ b/tests/qemuxml2argvdata/pseries-features.xml @@ -2,27 +2,17 @@ guest 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 524288 - 524288 1 hvm - - - destroy - restart - destroy /usr/bin/qemu-system-ppc64 - - - - - + + - diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2= xmloutdata/pseries-features.xml deleted file mode 120000 index 1b01dbace6..0000000000 --- a/tests/qemuxml2xmloutdata/pseries-features.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2= xmloutdata/pseries-features.xml new file mode 100644 index 0000000000..e8ed842fb6 --- /dev/null +++ b/tests/qemuxml2xmloutdata/pseries-features.xml @@ -0,0 +1,28 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list