ui: ceph: make version handling actually future proof

It seems we did not prepare the GUI enough for the API changes
planned when stopping to broadcast the old single string version. We
have to use the node specific versions, not the global 'versions'
object.

Also use the `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>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-11-10 13:15:56 +01:00 committed by Thomas Lamprecht
parent d3eed3b4a8
commit d6fb92d747
3 changed files with 11 additions and 11 deletions

View File

@ -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');

View File

@ -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;

View File

@ -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,