[pve-devel] [PATCH manager] ui: ceph: add more compatibilty code for versions

Dominik Csapak d.csapak at proxmox.com
Fri Nov 12 17:01:04 CET 2021


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 at 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






More information about the pve-devel mailing list