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 2/2] ui: ceph: fix version handling
Date: Wed, 10 Nov 2021 13:15:56 +0100	[thread overview]
Message-ID: <20211110121556.500448-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20211110121556.500448-1-d.csapak@proxmox.com>

it seems we did not prepare the gui enough for the api changes.
we have to use the node specific versions, not the global 'versions'
object.

also use PVE.Utils.compare_ceph_versions everywhere, since some versions
are strings and others are the parts of the version (e.g. ["16", "2, "6"])

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

diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index aea38d6c..b297d3ae 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -334,7 +334,7 @@ Ext.define('PVE.node.CephOsdTree', {
 			    return;
 			}
 
-			if (node.version !== maxversion && maxversion !== "0") {
+			if (PVE.Utils.compare_ceph_versions(node.version, maxversion) !== 0 && maxversion !== "0") {
 			    mixedversions = true;
 			}
 
@@ -503,8 +503,8 @@ Ext.define('PVE.node.CephOsdTree', {
 	    let icon = "";
 	    let version = value || "";
 	    let maxversion = vm.get('maxversion');
-	    if (value && value !== maxversion) {
-		if (rec.data.type === 'host' || versions[rec.data.host] !== 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) {
 		    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 6cd75618..4fc9d0af 100644
--- a/www/manager6/ceph/Services.js
+++ b/www/manager6/ceph/Services.js
@@ -50,9 +50,9 @@ Ext.define('PVE.ceph.Services', {
 	// order guarantee since es2020, but browsers did so before. Note, integers would break it.
 	const healthmap = Object.keys(healthstates);
 	let maxversion = "00.0.00";
-	Object.values(metadata.version || {}).forEach(function(version) {
-	    if (PVE.Utils.compare_ceph_versions(version, maxversion) > 0) {
-		maxversion = version;
+	Object.values(metadata.node || {}).forEach(function(node) {
+	    if (PVE.Utils.compare_ceph_versions(node?.version?.parts, maxversion) > 0) {
+		maxversion = node?.version?.parts;
 	    }
 	});
 	var quorummap = status && status.quorum_names ? status.quorum_names : [];
@@ -183,7 +183,7 @@ Ext.define('PVE.ceph.Services', {
 		if (result.version) {
 		    result.statuses.push(gettext('Version') + ": " + result.version);
 
-		    if (result.version !== maxversion) {
+		    if (PVE.Utils.compare_ceph_versions(result.version, maxversion) !== 0) {
 			if (metadata.version[host] === maxversion) {
 			    if (result.health > healthstates.HEALTH_OLD) {
 				result.health = healthstates.HEALTH_OLD;
diff --git a/www/manager6/ceph/StatusDetail.js b/www/manager6/ceph/StatusDetail.js
index 1ca185f6..dbc55afe 100644
--- a/www/manager6/ceph/StatusDetail.js
+++ b/www/manager6/ceph/StatusDetail.js
@@ -192,9 +192,9 @@ Ext.define('PVE.ceph.StatusDetail', {
 	me.suspendLayout = true;
 
 	let maxversion = "0";
-	Object.values(metadata.version || {}).forEach(function(version) {
-	    if (PVE.Utils.compare_ceph_versions(version, maxversion) > 0) {
-		maxversion = version;
+	Object.values(metadata.node || {}).forEach(function(node) {
+	    if (PVE.Utils.compare_ceph_versions(node?.version?.parts, maxversion) > 0) {
+		maxversion = node?.version?.parts;
 	    }
 	});
 
@@ -203,7 +203,7 @@ Ext.define('PVE.ceph.StatusDetail', {
 	if (metadata.osd) {
 	    metadata.osd.forEach(function(osd) {
 		let version = PVE.Utils.parse_ceph_version(osd);
-		if (version !== maxversion) {
+		if (PVE.Utils.compare_ceph_versions(version, maxversion) !== 0) {
 		    oldosds.push({
 			id: osd.id,
 			version: version,
-- 
2.30.2





  parent reply	other threads:[~2021-11-10 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 12:15 [pve-devel] [PATCH manager 0/2] fix ceph version handling in gui Dominik Csapak
2021-11-10 12:15 ` [pve-devel] [PATCH manager 1/2] api: ceph: fix getting ceph versions Dominik Csapak
2021-11-10 12:15 ` Dominik Csapak [this message]
2021-11-10 12:58 ` [pve-devel] [PATCH manager 0/2] fix ceph version handling in gui Thomas Lamprecht
2021-11-10 13:40 ` [pve-devel] applied-series: " Thomas Lamprecht

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=20211110121556.500448-3-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