mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-14 09:38:03 +00:00

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>
51 lines
976 B
JavaScript
51 lines
976 B
JavaScript
Ext.define('PVE.form.CephPoolSelector', {
|
|
extend: 'Ext.form.field.ComboBox',
|
|
alias: 'widget.pveCephPoolSelector',
|
|
|
|
allowBlank: false,
|
|
valueField: 'pool_name',
|
|
displayField: 'pool_name',
|
|
editable: false,
|
|
queryMode: 'local',
|
|
|
|
initComponent: function() {
|
|
var me = this;
|
|
|
|
if (!me.nodename) {
|
|
throw "no nodename given";
|
|
}
|
|
|
|
let onlyRBDPools = ({ data }) =>
|
|
!data?.application_metadata || !!data?.application_metadata?.rbd;
|
|
|
|
var store = Ext.create('Ext.data.Store', {
|
|
fields: ['name'],
|
|
sorters: 'name',
|
|
filters: [
|
|
onlyRBDPools,
|
|
],
|
|
proxy: {
|
|
type: 'proxmox',
|
|
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
|
|
},
|
|
});
|
|
|
|
Ext.apply(me, {
|
|
store: store,
|
|
});
|
|
|
|
me.callParent();
|
|
|
|
store.load({
|
|
callback: function(rec, op, success) {
|
|
let filteredRec = rec.filter(onlyRBDPools);
|
|
|
|
if (success && filteredRec.length > 0) {
|
|
me.select(filteredRec[0]);
|
|
}
|
|
},
|
|
});
|
|
},
|
|
|
|
});
|