mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 11:46:44 +00:00
ui: only allow rbd pools to be added as rbd storage
previously the ui would allow adding all pools (even the default ceph-mon pools) as storage. this could lead to issues when users did use these pools as storage (e.g.: vms missing their disks after a migration). hence, restrict the pool selector to rbd pools. fails gracefully by reverting to the previous behavior if a pool has no application assigned to it. Signed-off-by: Stefan Sterz <s.sterz@proxmox.com> Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
parent
7818083008
commit
eba38fa4b2
@ -15,9 +15,15 @@ Ext.define('PVE.form.CephPoolSelector', {
|
|||||||
throw "no nodename given";
|
throw "no nodename given";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let onlyRBDPools = ({ data }) =>
|
||||||
|
!data?.application_metadata || !!data?.application_metadata?.rbd;
|
||||||
|
|
||||||
var store = Ext.create('Ext.data.Store', {
|
var store = Ext.create('Ext.data.Store', {
|
||||||
fields: ['name'],
|
fields: ['name'],
|
||||||
sorters: 'name',
|
sorters: 'name',
|
||||||
|
filters: [
|
||||||
|
onlyRBDPools,
|
||||||
|
],
|
||||||
proxy: {
|
proxy: {
|
||||||
type: 'proxmox',
|
type: 'proxmox',
|
||||||
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
|
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
|
||||||
@ -32,8 +38,10 @@ Ext.define('PVE.form.CephPoolSelector', {
|
|||||||
|
|
||||||
store.load({
|
store.load({
|
||||||
callback: function(rec, op, success) {
|
callback: function(rec, op, success) {
|
||||||
if (success && rec.length > 0) {
|
let filteredRec = rec.filter(onlyRBDPools);
|
||||||
me.select(rec[0]);
|
|
||||||
|
if (success && filteredRec.length > 0) {
|
||||||
|
me.select(filteredRec[0]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user