storage content GUI: improve detection of backup volumes

Include new proxmox backup server volumes.
This commit is contained in:
Dietmar Maurer 2020-02-19 13:59:44 +01:00 committed by Thomas Lamprecht
parent 1a87db9e56
commit 3b8f599bca
3 changed files with 14 additions and 11 deletions

View File

@ -545,6 +545,14 @@ Ext.define('PVE.Utils', { utilities: {
'snippets': gettext('Snippets') 'snippets': gettext('Snippets')
}, },
volume_is_qemu_backup: function(volid, format) {
return format === 'pbs-vm' || volid.match(':backup/vzdump-qemu-');
},
volume_is_lxc_backup: function(volid, format) {
return format === 'pbs-ct' || volid.match(':backup/vzdump-(lxc|openvz)-');
},
storageSchema: { storageSchema: {
dir: { dir: {
name: Proxmox.Utils.directoryText, name: Proxmox.Utils.directoryText,
@ -661,7 +669,7 @@ Ext.define('PVE.Utils', { utilities: {
Ext.String.leftPad(data.channel,2, '0') + Ext.String.leftPad(data.channel,2, '0') +
" ID " + data.id + " LUN " + data.lun; " ID " + data.id + " LUN " + data.lun;
} }
return data.volid.replace(/^.*:(.*\/)?/,''); return data.volid.replace(/^.*?:(.*?\/)?/,'');
}, },
render_serverity: function (value) { render_serverity: function (value) {
@ -1337,4 +1345,3 @@ Ext.define('PVE.Utils', { utilities: {
} }
}); });

View File

@ -27,17 +27,13 @@ Ext.define('PVE.grid.BackupView', {
} }
var vmtypeFilter; var vmtypeFilter;
if (vmtype === 'openvz') { if (vmtype === 'lxc' || vmtype === 'openvz') {
vmtypeFilter = function(item) { vmtypeFilter = function(item) {
return item.data.volid.match(':backup/vzdump-openvz-'); return PVE.Utils.volume_is_lxc_backup(item.data.volid, item.data.format);
};
} else if (vmtype === 'lxc') {
vmtypeFilter = function(item) {
return item.data.volid.match(':backup/vzdump-lxc-');
}; };
} else if (vmtype === 'qemu') { } else if (vmtype === 'qemu') {
vmtypeFilter = function(item) { vmtypeFilter = function(item) {
return item.data.volid.match(':backup/vzdump-qemu-'); return PVE.Utils.volume_is_qemu_backup(item.data.volid, item.data.format);
}; };
} else { } else {
throw "unsupported VM type '" + vmtype + "'"; throw "unsupported VM type '" + vmtype + "'";

View File

@ -519,9 +519,9 @@ Ext.define('PVE.storage.ContentView', {
}, },
handler: function(b, e, rec) { handler: function(b, e, rec) {
var vmtype; var vmtype;
if (rec.data.volid.match(/vzdump-qemu-/)) { if (PVE.Utils.volume_is_qemu_backup(rec.data.volid, rec.data.format)) {
vmtype = 'qemu'; vmtype = 'qemu';
} else if (rec.data.volid.match(/vzdump-openvz-/) || rec.data.volid.match(/vzdump-lxc-/)) { } else if (PVE.Utils.volume_is_lxc_backup(rec.data.volid, rec.data.format)) {
vmtype = 'lxc'; vmtype = 'lxc';
} else { } else {
return; return;