public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: ceph: add more compatibilty code for versions
Date: Fri, 12 Nov 2021 17:01:04 +0100	[thread overview]
Message-ID: <20211112160104.506805-1-d.csapak@proxmox.com> (raw)

we now have to handle the version of 'old' nodes, as well as the
new nodes, which are missing the 'version' field in the metadata/osd call

so set the 'versions' object to a default empty object for osds
and get the host version directly from the treenode
(the parent node of the osd node)

also compare the host version in the dashboard by getting first the
new version field, and the old one as fallback.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/ceph/OSD.js      | 5 +++--
 www/manager6/ceph/Services.js | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index b2120956..9e737852 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -316,7 +316,7 @@ Ext.define('PVE.node.CephOsdTree', {
 		    if (selected.length) {
 			name = selected[0].data.name;
 		    }
-		    vm.set('versions', data.versions);
+		    vm.set('versions', data.versions || {});
 		    // extract max version
 		    let maxversion = "0";
 		    let mixedversions = false;
@@ -507,7 +507,8 @@ Ext.define('PVE.node.CephOsdTree', {
 	    let version = value || "";
 	    let maxversion = vm.get('maxversion');
 	    if (value && PVE.Utils.compare_ceph_versions(value, maxversion) !== 0) {
-		if (rec.data.type === 'host' || PVE.Utils.compare_ceph_versions(versions[rec.data.host] || "", maxversion) !== 0) {
+		let host_version = rec.parentNode?.data?.version || versions[rec.data.host] || "";
+		if (rec.data.type === 'host' || PVE.Utils.compare_ceph_versions(host_version, maxversion) !== 0) {
 		    icon = PVE.Utils.get_ceph_icon_html('HEALTH_UPGRADE');
 		} else {
 		    icon = PVE.Utils.get_ceph_icon_html('HEALTH_OLD');
diff --git a/www/manager6/ceph/Services.js b/www/manager6/ceph/Services.js
index 4fc9d0af..77ade27b 100644
--- a/www/manager6/ceph/Services.js
+++ b/www/manager6/ceph/Services.js
@@ -184,7 +184,8 @@ Ext.define('PVE.ceph.Services', {
 		    result.statuses.push(gettext('Version') + ": " + result.version);
 
 		    if (PVE.Utils.compare_ceph_versions(result.version, maxversion) !== 0) {
-			if (metadata.version[host] === maxversion) {
+			let host_version = metadata.node[host]?.version?.parts || metadata.version?[host] || "";
+			if (PVE.Utils.compare_ceph_versions(host_version, maxversion) === 0) {
 			    if (result.health > healthstates.HEALTH_OLD) {
 				result.health = healthstates.HEALTH_OLD;
 			    }
-- 
2.30.2





             reply	other threads:[~2021-11-12 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 16:01 Dominik Csapak [this message]
2021-11-12 16:03 ` [pve-devel] applied: " Thomas Lamprecht
2021-11-12 16:06 ` [pve-devel] " Thomas Lamprecht
2021-11-12 16:09 ` Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211112160104.506805-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal