From nobody Tue Feb 10 15:01:36 2026 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 1529946753438803.3462977601649; Mon, 25 Jun 2018 10:12:33 -0700 (PDT) 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 E9EE8308403F; Mon, 25 Jun 2018 17:12: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 81941183A3; Mon, 25 Jun 2018 17:12: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 17C614A469; Mon, 25 Jun 2018 17:12:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5PHC8w0030603 for ; Mon, 25 Jun 2018 13:12:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A33021565E1; Mon, 25 Jun 2018 17:12:08 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E0EF2166B5D for ; Mon, 25 Jun 2018 17:12:07 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 25 Jun 2018 19:11:58 +0200 Message-Id: <20180625171201.21827-5-abologna@redhat.com> In-Reply-To: <20180625171201.21827-1-abologna@redhat.com> References: <20180625171201.21827-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/7] conf: Tweak HPT feature 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.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.40]); Mon, 25 Jun 2018 17:12:32 +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 | 19 ++++++++--- src/qemu/qemu_command.c | 32 ++++++++++--------- tests/qemuxml2argvdata/pseries-features.xml | 14 ++------ tests/qemuxml2xmloutdata/pseries-features.xml | 29 ++++++++++++++++- 4 files changed, 62 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 069ff8c2f8..3f7b0d1bfe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27258,6 +27258,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, const char *type =3D NULL; int n; size_t i; + virBuffer attributeBuf =3D VIR_BUFFER_INITIALIZER; virBuffer childrenBuf =3D VIR_BUFFER_INITIALIZER; char *netprefix =3D NULL; =20 @@ -27773,12 +27774,21 @@ virDomainDefFormatInternal(virDomainDefPtr def, break; =20 case VIR_DOMAIN_FEATURE_HPT: - if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON || - def->hpt_resizing =3D=3D VIR_DOMAIN_HPT_RESIZING_NONE) + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON) break; =20 - virBufferAsprintf(buf, "\n", - virDomainHPTResizingTypeToString(def->hp= t_resizing)); + virBufferFreeAndReset(&attributeBuf); + + if (def->hpt_resizing !=3D VIR_DOMAIN_HPT_RESIZING_NONE) { + virBufferAsprintf(&attributeBuf, + " resizing=3D'%s'", + virDomainHPTResizingTypeToString(def= ->hpt_resizing)); + } + + if (virXMLFormatElement(buf, "hpt", + &attributeBuf, NULL) < 0) { + goto error; + } break; =20 /* coverity[dead_error_begin] */ @@ -28040,6 +28050,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, error: virBufferFreeAndReset(buf); virBufferFreeAndReset(&childrenBuf); + virBufferFreeAndReset(&attributeBuf); return -1; } =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 081314ed0a..5cd6d44a88 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7245,24 +7245,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.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list