From nobody Thu May 15 02:17:38 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 1516722552885689.6662855850049; Tue, 23 Jan 2018 07:49:12 -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 D641276532; Tue, 23 Jan 2018 15:49:10 +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 A7CC11727B; Tue, 23 Jan 2018 15:49:10 +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 6EEBC3FB1A; Tue, 23 Jan 2018 15:49:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0NFjtl9023541 for ; Tue, 23 Jan 2018 10:45:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7AF0717B70; Tue, 23 Jan 2018 15:45:55 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CDBBB65607 for ; Tue, 23 Jan 2018 15:45:42 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:02 +0100 Message-Id: <20180123154504.9541-4-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] conf: Remove obsolete feature 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.26]); Tue, 23 Jan 2018 15:49:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that the feature has been implemented, we can get rid of the original feature and thus ensure all pSeries features are grouped together in the same sub-element. Compatibility code is provided so that existing guests can be parsed and migrated successfully despite the change. Signed-off-by: Andrea Bolognani --- docs/formatdomain.html.in | 12 --- src/conf/domain_conf.c | 105 ++++++++++++++----= ---- src/conf/domain_conf.h | 2 - src/qemu/qemu_command.c | 20 ----- src/qemu/qemu_domain.c | 8 -- tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml | 4 +- 6 files changed, 71 insertions(+), 80 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b2584fbb0..1e2fccaeb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1774,7 +1774,6 @@ <pvspinlock state=3D'on'/> <gic version=3D'2'/> <ioapic driver=3D'qemu'/> - <hpt resizing=3D'required'/> </features> ... =20 @@ -1960,17 +1959,6 @@ which is also known as a split I/O APIC mode. Since 3.4.0 (QEMU/KVM only) -
hpt
-
Configure the HPT (Hash Page Table) of a pSeries guest. Possible - values for the resizing attribute are - enabled, which causes HPT resizing to be enabled if - both the guest and the host support it; disabled, w= hich - causes HPT resizing to be disabled regardless of guest and host - support; and required, which prevents the guest from - starting unless both the guest and the host support HPT resizing= . If - the attribute is not defined, the hypervisor default will be use= d. - Since 3.10.0 (QEMU/KVM only) -
vmcoreinfo
Enable QEMU vmcoreinfo device to let the guest kernel save debug details. Since 3.10.0 (QEMU only) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 577a804df..763228ca7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -150,7 +150,6 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "gic", "smm", "ioapic", - "hpt", "vmcoreinfo", "pseries", ); @@ -18857,6 +18856,36 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; =20 for (i =3D 0; i < n; i++) { + + /* Compatibility code. + * + * Between 3.10.0 and 4.1.0, we had instead of + * , and we need to be able to parse exist= ing + * guest configurations; this takes care of it. Note that the comp= at + * code, like the original implementation and unlike the new one, + * must handle gracefully the 'resizing' attribute being absent */ + if (STREQ((const char *) nodes[i]->name, "hpt")) { + tmp =3D virXMLPropString(nodes[i], "resizing"); + if (tmp) { + int value =3D virDomainHPTResizingTypeFromString(tmp); + if (value < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid value '%s' for '%s' " + "attribute of '%s' pSeries feature"), + tmp, "resizing", nodes[i]->name); + goto error; + } + + def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D VIR_TRISTATE= _SWITCH_ON; + def->pseries_features[VIR_DOMAIN_PSERIES_HPT] =3D VIR_TRIS= TATE_SWITCH_ON; + def->pseries_hpt_resizing =3D value; + + VIR_FREE(tmp); + } + i++; + continue; + } + int val =3D virDomainFeatureTypeFromString((const char *)nodes[i]-= >name); if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -18951,22 +18980,6 @@ virDomainDefParseXML(xmlDocPtr xml, } break; =20 - case VIR_DOMAIN_FEATURE_HPT: - tmp =3D virXMLPropString(nodes[i], "resizing"); - if (tmp) { - int value =3D virDomainHPTResizingTypeFromString(tmp); - if (value < 0) { - 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; - VIR_FREE(tmp); - } - break; - /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; @@ -21228,18 +21241,6 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= Ptr src, return false; } =20 - /* HPT resizing */ - if (src->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N) { - if (src->hpt_resizing !=3D dst->hpt_resizing) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("HPT resizing configuration differs: " - "source: '%s', destination: '%s'"), - virDomainHPTResizingTypeToString(src->hpt_resiz= ing), - virDomainHPTResizingTypeToString(dst->hpt_resiz= ing)); - return false; - } - } - return true; } =20 @@ -26565,10 +26566,44 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); break; =20 - case VIR_DOMAIN_FEATURE_PSERIES: + case VIR_DOMAIN_FEATURE_PSERIES: { + bool needsPSeriesElement =3D false; + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON) break; =20 + /* Figure out whether we need the element. + * For compatibility reasons (see below) we might need to + * skip it even though some pSeries features are enabled: + * namely, if the HPT feature is enabled and we're formatt= ing + * a migratable XML */ + for (j =3D 0; j < VIR_DOMAIN_PSERIES_LAST; j++) { + if (def->pseries_features[j] =3D=3D VIR_TRISTATE_SWITC= H_ABSENT) + continue; + if ((virDomainPSeries) j =3D=3D VIR_DOMAIN_PSERIES_HPT= && + flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) { + continue; + } + needsPSeriesElement =3D true; + break; + } + + /* Compatibility code. + * Between 3.10.0 and 4.1.0, we had instead + * of , and we need to be able to + * migrate existing guests back and forth between old libv= irt + * and new libvirt; this takes care of it, by using the old + * element when formatting a migratable XML */ + if (def->pseries_features[VIR_DOMAIN_PSERIES_HPT] =3D=3D V= IR_TRISTATE_SWITCH_ON && + flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) { + virBufferAsprintf(buf, "\n", + virDomainHPTResizingTypeToString(def= ->pseries_hpt_resizing)); + } + + /* Stop here unless we need the element */ + if (!needsPSeriesElement) + break; + virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); for (j =3D 0; j < VIR_DOMAIN_PSERIES_LAST; j++) { @@ -26576,6 +26611,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, case VIR_DOMAIN_PSERIES_HPT: if (def->pseries_features[j] !=3D VIR_TRISTATE_SWI= TCH_ON) break; + if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) + break; =20 virBufferAsprintf(buf, "\n", virDomainHPTResizingTypeToString= (def->pseries_hpt_resizing)); @@ -26588,6 +26625,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); break; + } =20 case VIR_DOMAIN_FEATURE_CAPABILITIES: if (def->features[i] =3D=3D VIR_DOMAIN_CAPABILITIES_POLICY= _DEFAULT && @@ -26625,13 +26663,6 @@ 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)); - } - break; - /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e4ae2a26c..91db2220a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1738,7 +1738,6 @@ typedef enum { VIR_DOMAIN_FEATURE_GIC, VIR_DOMAIN_FEATURE_SMM, VIR_DOMAIN_FEATURE_IOAPIC, - VIR_DOMAIN_FEATURE_HPT, VIR_DOMAIN_FEATURE_VMCOREINFO, VIR_DOMAIN_FEATURE_PSERIES, =20 @@ -2360,7 +2359,6 @@ struct _virDomainDef { virGICVersion gic_version; char *hyperv_vendor_id; virDomainIOAPIC ioapic; - virDomainHPTResizing hpt_resizing; virDomainHPTResizing pseries_hpt_resizing; =20 /* These options are of type virTristateSwitch: ON =3D keep, OFF =3D d= rop */ diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a053b597c..26122b048 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7645,26 +7645,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } } =20 - if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWIT= CH_ON) { - const char *str; - - 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; - } - - virBufferAsprintf(&buf, ",resize-hpt=3D%s", str); - } - if (def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D=3D VIR_TRISTATE_= SWITCH_ON) { const char *value; =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index edef3838e..c604f0657 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3132,14 +3132,6 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) return -1; } =20 - if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N && - !qemuDomainIsPSeries(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", - _("HPT tuning is only supported for pSeries guests"= )); - return -1; - } - return 0; } =20 diff --git a/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml b/tests/qemu= xml2xmloutdata/pseries-hpt-resizing.xml index 5dd0dbd0b..b6a89ffe2 100644 --- a/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml +++ b/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml @@ -9,7 +9,9 @@ - + + + destroy --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list