From nobody Tue Feb 10 09:24:38 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 1517935441751369.875823125343; Tue, 6 Feb 2018 08:44:01 -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 9A51928225; Tue, 6 Feb 2018 16:44:00 +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 6B8DC5C892; Tue, 6 Feb 2018 16:44:00 +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 3194518033F6; Tue, 6 Feb 2018 16:44:00 +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 w16GhxPG008644 for ; Tue, 6 Feb 2018 11:43:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 34B4C6046C; Tue, 6 Feb 2018 16:43:59 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF7065C461 for ; Tue, 6 Feb 2018 16:43:55 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 6 Feb 2018 17:42:59 +0100 Message-Id: <20180206164300.13450-11-abologna@redhat.com> In-Reply-To: <20180206164300.13450-1-abologna@redhat.com> References: <20180206164300.13450-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/11] conf: Improve HPT feature handling 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.30]); Tue, 06 Feb 2018 16:44:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of storing separately whether the feature is enabled or not and what resizing policy should be used, store both of them in a single place. Signed-off-by: Andrea Bolognani Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 26 ++++++++++++-------------- src/conf/domain_conf.h | 4 ++-- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_domain.c | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 19884ec13..c1d549594 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -906,6 +906,7 @@ VIR_ENUM_IMPL(virDomainIOAPIC, =20 VIR_ENUM_IMPL(virDomainHPTResizing, VIR_DOMAIN_HPT_RESIZING_LAST, + "none", "enabled", "disabled", "required", @@ -19239,14 +19240,13 @@ virDomainDefParseXML(xmlDocPtr xml, tmp =3D virXMLPropString(nodes[i], "resizing"); if (tmp) { int value =3D virDomainHPTResizingTypeFromString(tmp); - if (value < 0) { + if (value < 0 || value =3D=3D VIR_DOMAIN_HPT_RESIZING_NONE= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unknown HPT resizing setting: %s"), tmp); goto error; } - def->hpt_resizing =3D value; - def->features[val] =3D VIR_TRISTATE_SWITCH_ON; + def->features[val] =3D value; VIR_FREE(tmp); } break; @@ -21377,16 +21377,13 @@ virDomainDefFeaturesCheckABIStability(virDomainDe= fPtr src, break; =20 case VIR_DOMAIN_FEATURE_HPT: - if (src->features[i] !=3D dst->features[i] || - src->hpt_resizing !=3D dst->hpt_resizing) { + if (src->features[i] !=3D dst->features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of feature '%s:%s' differs: " - "source: '%s:%s', destination: '%s:%s'"), + "source: '%s', destination: '%s'"), featureName, "resizing", - virTristateSwitchTypeToString(src->features= [i]), - virDomainHPTResizingTypeToString(src->hpt_r= esizing), - virTristateSwitchTypeToString(dst->features= [i]), - virDomainHPTResizingTypeToString(dst->hpt_r= esizing)); + virDomainHPTResizingTypeToString(src->featu= res[i]), + virDomainHPTResizingTypeToString(dst->featu= res[i])); return false; } break; @@ -26947,10 +26944,11 @@ virDomainDefFormatInternal(virDomainDefPtr def, break; =20 case VIR_DOMAIN_FEATURE_HPT: - if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) { - virBufferAsprintf(buf, "\n", - virDomainHPTResizingTypeToString(def= ->hpt_resizing)); - } + if (def->features[i] =3D=3D VIR_DOMAIN_HPT_RESIZING_NONE) + break; + + virBufferAsprintf(buf, "\n", + virDomainHPTResizingTypeToString(def->fe= atures[i])); break; =20 /* coverity[dead_error_begin] */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 20f0efc36..4e9044ae6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1871,7 +1871,8 @@ typedef enum { VIR_ENUM_DECL(virDomainIOAPIC); =20 typedef enum { - VIR_DOMAIN_HPT_RESIZING_ENABLED =3D 0, + VIR_DOMAIN_HPT_RESIZING_NONE =3D 0, + VIR_DOMAIN_HPT_RESIZING_ENABLED, VIR_DOMAIN_HPT_RESIZING_DISABLED, VIR_DOMAIN_HPT_RESIZING_REQUIRED, =20 @@ -2364,7 +2365,6 @@ struct _virDomainDef { unsigned int hyperv_spinlocks; virGICVersion gic_version; char *hyperv_vendor_id; - virDomainHPTResizing hpt_resizing; =20 /* These options are of type virTristateSwitch: ON =3D keep, OFF =3D d= rop */ int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3aabdf7a2..faf09a599 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7266,7 +7266,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } } =20 - if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWIT= CH_ON) { + if (def->features[VIR_DOMAIN_FEATURE_HPT] !=3D VIR_DOMAIN_HPT_RESI= ZING_NONE) { const char *str; =20 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE= _HPT)) { @@ -7276,7 +7276,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, goto cleanup; } =20 - str =3D virDomainHPTResizingTypeToString(def->hpt_resizing); + str =3D virDomainHPTResizingTypeToString(def->features[VIR_DOM= AIN_FEATURE_HPT]); if (!str) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Invalid setting for HPT resizing")); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index cfea1f500..5d21d3703 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3244,7 +3244,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def) break; =20 case VIR_DOMAIN_FEATURE_HPT: - if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON && + if (def->features[i] !=3D VIR_DOMAIN_HPT_RESIZING_NONE && !qemuDomainIsPSeries(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("The '%s' feature is only supported for %= s guests"), --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list