From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 824B21FF2D6 for ; Mon, 22 Jul 2024 17:38:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4E174357C9; Mon, 22 Jul 2024 17:39:05 +0200 (CEST) Message-ID: Date: Mon, 22 Jul 2024 17:38:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox VE development discussion , Max Carrara References: <20240701141040.643701-1-m.carrara@proxmox.com> <20240701141040.643701-7-m.carrara@proxmox.com> Content-Language: en-GB, de-AT From: Thomas Lamprecht Autocrypt: addr=t.lamprecht@proxmox.com; keydata= xsFNBFsLjcYBEACsaQP6uTtw/xHTUCKF4VD4/Wfg7gGn47+OfCKJQAD+Oyb3HSBkjclopC5J uXsB1vVOfqVYE6PO8FlD2L5nxgT3SWkc6Ka634G/yGDU3ZC3C/7NcDVKhSBI5E0ww4Qj8s9w OQRloemb5LOBkJNEUshkWRTHHOmk6QqFB/qBPW2COpAx6oyxVUvBCgm/1S0dAZ9gfkvpqFSD 90B5j3bL6i9FIv3YGUCgz6Ue3f7u+HsEAew6TMtlt90XV3vT4M2IOuECG/pXwTy7NtmHaBQ7 UJBcwSOpDEweNob50+9B4KbnVn1ydx+K6UnEcGDvUWBkREccvuExvupYYYQ5dIhRFf3fkS4+ wMlyAFh8PQUgauod+vqs45FJaSgTqIALSBsEHKEs6IoTXtnnpbhu3p6XBin4hunwoBFiyYt6 YHLAM1yLfCyX510DFzX/Ze2hLqatqzY5Wa7NIXqYYelz7tXiuCLHP84+sV6JtEkeSUCuOiUY virj6nT/nJK8m0BzdR6FgGtNxp7RVXFRz/+mwijJVLpFsyG1i0Hmv2zTn3h2nyGK/I6yhFNt dX69y5hbo6LAsRjLUvZeHXpTU4TrpN/WiCjJblbj5um5eEr4yh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6AyZ6FxTApm8wq8NT2cryWPWTF BDSGB3ujWHMM8ERRYJPcBSjTvt0GcEqnd+OSGgxTkGOdufn51oz82zfpVo1t+J/FNz6MRMcg 8nEC+uKvgzH1nujxJ5pRCBOquFZaGn/p71Yr0oVitkttLKblFsqwa+10Lt6HBxm+2+VLp4Ja 0WZNncZciz3V3cuArpan/ZhhyiWYV5FD0pOXPCJIx7WS9PTtxiv0AOS4ScWEUmBxyhFeOpYa DrEx In-Reply-To: <20240701141040.643701-7-m.carrara@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.052 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v2 pve-manager 06/10] ui: ceph: services: parse and display build commit X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: Lukas Wagner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Am 01/07/2024 um 16:10 schrieb Max Carrara: > This commit adds `PVE.Utils.parseCephBuildCommit`, which can be used > to get the full hash "eccf199d..." in parentheses from a string like > the following: > > ceph version 17.2.7 (eccf199d63457659c09677399928203b7903c888) quincy (stable) > > This hash is displayed and taken into account when comparing monitor > and manager versions in the client. Specifically, the shortened build > commit is now displayed in parentheses next to the version for both > monitors and managers like so: > > 18.2.2 (abcd1234) > > Should the build commit of the running service differ from the one > that's installed on the host, the newer build commit will also be > shown in parentheses: > > 18.2.2 (abcd1234 -> 5678fedc) > > The icon displayed for running a service with an outdated build is the > same as for running an outdated version. The conditional display of > cluster health-related icons remains the same otherwise. > > The Ceph summary view also displays the hash and will show a warning > if a service is running with a build commit that doesn't match the one > that's advertised by the host. > > Signed-off-by: Max Carrara > Tested-by: Lukas Wagner > Reviewed-by: Lukas Wagner > --- > Changes v1 --> v2: > * use camelCase instead of snake_case (thanks Lukas!) > * use more descriptive variable names (thanks Lukas!) > * use `let` instead of `const` for variables where applicable (thanks Lukas!) > > www/manager6/Utils.js | 14 ++++++++++++++ > www/manager6/ceph/ServiceList.js | 32 ++++++++++++++++++++++++++------ > www/manager6/ceph/Services.js | 14 +++++++++++++- > 3 files changed, 53 insertions(+), 7 deletions(-) > > diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js > index 74e46694..f2fd0f7e 100644 > --- a/www/manager6/Utils.js > +++ b/www/manager6/Utils.js > @@ -128,6 +128,20 @@ Ext.define('PVE.Utils', { > return undefined; > }, > > + parseCephBuildCommit: function(service) { > + if (service.ceph_version) { > + // See PVE/Ceph/Tools.pm - get_local_version > + const match = service.ceph_version.match( > + /^ceph.*\sv?(?:\d+(?:\.\d+)+)\s+(?:\(([a-zA-Z0-9]+)\))/, > + ); > + if (match) { > + return match[1]; > + } > + } > + > + return undefined; > + }, > + > compare_ceph_versions: function(a, b) { > let avers = []; > let bvers = []; > diff --git a/www/manager6/ceph/ServiceList.js b/www/manager6/ceph/ServiceList.js > index 76710146..d994aa4e 100644 > --- a/www/manager6/ceph/ServiceList.js > +++ b/www/manager6/ceph/ServiceList.js > @@ -102,21 +102,41 @@ Ext.define('PVE.node.CephServiceController', { > if (value === undefined) { > return ''; > } > + > + let buildCommit = PVE.Utils.parseCephBuildCommit(rec.data) ?? ''; > + > let view = this.getView(); > - let host = rec.data.host, nodev = [0]; > + let host = rec.data.host; > + > + let versionNode = [0]; > + let buildCommitNode = ''; > if (view.nodeversions[host] !== undefined) { > - nodev = view.nodeversions[host].version.parts; > + versionNode = view.nodeversions[host].version.parts; > + buildCommitNode = view.nodeversions[host].buildcommit; > } > > + let bcChanged = I'd prefer the more telling `buildCommitChanged` variable name here. > + buildCommit !== '' && > + buildCommitNode !== '' && > + buildCommit !== buildCommitNode; above hunk and... > + > let icon = ''; > - if (PVE.Utils.compare_ceph_versions(view.maxversion, nodev) > 0) { > + if (PVE.Utils.compare_ceph_versions(view.maxversion, versionNode) > 0) { > icon = PVE.Utils.get_ceph_icon_html('HEALTH_UPGRADE'); > - } else if (PVE.Utils.compare_ceph_versions(nodev, value) > 0) { > + } else if (PVE.Utils.compare_ceph_versions(versionNode, value) > 0) { > icon = PVE.Utils.get_ceph_icon_html('HEALTH_OLD'); > - } else if (view.mixedversions) { > + } else if (view.mixedversions && !bcChanged) { > icon = PVE.Utils.get_ceph_icon_html('HEALTH_OK'); > } > - return icon + value; > + > + let buildCommitPart = buildCommit.substring(0, 9); > + if (bcChanged) { > + const arrow = ''; > + icon ||= PVE.Utils.get_ceph_icon_html('HEALTH_OLD'); > + buildCommitPart = `${buildCommit.substring(0, 9)}${arrow}${buildCommitNode.substring(0, 9)}`; > + } ... most of the above hunk might be better factored out in a helper function, as this is basically 1:1 duplication here and in patch 08/10. The function could e.g. take both current and new commits as parameters and return the rendered build commit (buildCommitPart) and a boolean about if it should be interpreted as changed (updated?). That could be in form of an array or object and then destructured here. also, maybe rendered this as `build ${buildCommit.substring(0, 9)} ...` to give some name for users to ask/talk about when wondering what this funny hex string is. > + > + return `${icon}${value} (${buildCommitPart})`; > }, > > getMaxVersions: function(store, records, success) { > diff --git a/www/manager6/ceph/Services.js b/www/manager6/ceph/Services.js > index b9fc52c8..7ce289dd 100644 > --- a/www/manager6/ceph/Services.js > +++ b/www/manager6/ceph/Services.js > @@ -155,6 +155,7 @@ Ext.define('PVE.ceph.Services', { > title: metadata[type][id].name || name, > host: host, > version: PVE.Utils.parse_ceph_version(metadata[type][id]), > + buildcommit: PVE.Utils.parseCephBuildCommit(metadata[type][id]), > service: metadata[type][id].service, > addr: metadata[type][id].addr || metadata[type][id].addrs || Proxmox.Utils.unknownText, > }; > @@ -181,7 +182,10 @@ Ext.define('PVE.ceph.Services', { > } > > if (result.version) { > - result.statuses.push(gettext('Version') + ": " + result.version); > + const buildCommitHost = metadata.node[host]?.buildcommit || ""; > > + > + const buildCommitShort = result.buildcommit.substring(0, 9); naming is IMO not ideal, I'd rather use something like `buildCommitInstalled` and `buildCommitRunning` to clarify what each value actually represents. > + result.statuses.push(gettext('Version') + `: ${result.version} (${buildCommitShort})`); > > if (PVE.Utils.compare_ceph_versions(result.version, maxversion) !== 0) { > let host_version = metadata.node[host]?.version?.parts || metadata.version?.[host] || ""; > @@ -202,6 +206,14 @@ Ext.define('PVE.ceph.Services', { > gettext('Other cluster members use a newer version of this service, please upgrade and restart'), > ); > } > + } else if (buildCommitHost !== "" && result.buildcommit !== buildCommitHost) { > + if (result.health > healthstates.HEALTH_OLD) { > + result.health = healthstates.HEALTH_OLD; > + } > + result.messages.push( > + PVE.Utils.get_ceph_icon_html('HEALTH_OLD', true) + > + gettext('A newer version was installed but old version still running, please restart'), maybe s/version/build/ or possibly s/version/build of the same release/ to better convey that the major release was unchanged but a newer build got pulled in. > + ); > } > } > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel