mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-16 03:27:40 +00:00
followup: make ceph version handling more flexible
ceph has a bad reputation for chaging such minor things a few times, even during a stable release, and as here a bit more flexibillity cost exactly nothing let's do so and accept versions with one to arbitrary version levels Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
005e0a6091
commit
35306f4767
@ -108,7 +108,7 @@ Ext.define('PVE.Utils', { utilities: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (service.ceph_version) {
|
if (service.ceph_version) {
|
||||||
var match = service.ceph_version.match(/version (\d+\.\d+\.\d+)/);
|
var match = service.ceph_version.match(/version (\d+(\.\d+)*)/);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match[1];
|
return match[1];
|
||||||
}
|
}
|
||||||
@ -121,32 +121,26 @@ Ext.define('PVE.Utils', { utilities: {
|
|||||||
if (a === b) {
|
if (a === b) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
let avers = a.toString().split('.');
|
||||||
|
let bvers = b.toString().split('.');
|
||||||
|
|
||||||
var match_a = a.toString().match(/^(\d+)\.(\d+).(\d+)$/);
|
while (true) {
|
||||||
var match_b = b.toString().match(/^(\d+)\.(\d+).(\d+)$/);
|
let av = avers.shift();
|
||||||
|
let bv = bvers.shift();
|
||||||
|
|
||||||
if (!match_a && !match_b) {
|
if (av === undefined && bv === undefined) {
|
||||||
// both versions invalid/undefined
|
return 0;
|
||||||
return 0;
|
} else if (av === undefined) {
|
||||||
} else if(!match_a) {
|
return -1;
|
||||||
// a is undefined/invalid but b not
|
} else if (bv === undefined) {
|
||||||
return -1;
|
return 1;
|
||||||
} else if(!match_b) {
|
} else {
|
||||||
// b is undefined/invalid but a not
|
let diff = parseInt(av, 10) - parseInt(bv, 10);
|
||||||
return 1;
|
if (diff != 0) return diff;
|
||||||
}
|
// else we need to look at the next parts
|
||||||
|
|
||||||
var i;
|
|
||||||
for (i = 1; i <= 3; i++) {
|
|
||||||
var ver_a = parseInt(match_a[i], 10);
|
|
||||||
var ver_b = parseInt(match_b[i], 10);
|
|
||||||
if (ver_a !== ver_b) {
|
|
||||||
return ver_a - ver_b;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// all parts were the same
|
|
||||||
return 0;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get_ceph_icon_html: function(health, fw) {
|
get_ceph_icon_html: function(health, fw) {
|
||||||
|
Loading…
Reference in New Issue
Block a user