add new "RBD (PVE)" storage choice

this is for adding a pve managed ceph rbd storage, so that the user
just has to select the pool, and does not need to write the monitor
hosts and copy the keyring

the old "RBD" is renamed to "RBD (external)"

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2017-09-05 16:23:48 +02:00 committed by Fabian Grünbichler
parent d6f5549e58
commit 3c23c0258b
3 changed files with 65 additions and 28 deletions

View File

@ -775,7 +775,10 @@ Ext.define('PVE.Utils', { utilities: {
return Ext.Date.format(date, "Y-m-d");
},
format_storage_type: function(value) {
format_storage_type: function(value, md, record) {
if (value === 'rbd' && record && !record.get('monhost')) {
value = 'pveceph';
}
if (value === 'dir') {
return PVE.Utils.directoryText;
} else if (value === 'nfs') {
@ -789,7 +792,9 @@ Ext.define('PVE.Utils', { utilities: {
} else if (value === 'iscsi') {
return 'iSCSI';
} else if (value === 'rbd') {
return 'RBD';
return 'RBD (external)';
} else if (value === 'pveceph') {
return 'RBD (PVE)';
} else if (value === 'sheepdog') {
return 'Sheepdog';
} else if (value === 'zfs') {

View File

@ -62,7 +62,8 @@ Ext.define('PVE.dc.StorageView', {
return;
}
var win = Ext.create(editor, {
storageId: rec.data.storage
storageId: rec.data.storage,
pveceph: !rec.data.monhost
});
win.show();
@ -165,6 +166,17 @@ Ext.define('PVE.dc.StorageView', {
win.show();
}
},
{
text: PVE.Utils.format_storage_type('pveceph'),
iconCls: 'fa fa-fw fa-building',
handler: function() {
var win = Ext.create('PVE.storage.RBDEdit', {
pveceph: 1
});
win.on('destroy', reload);
win.show();
}
},
{
text: PVE.Utils.format_storage_type('rbd'),
iconCls: 'fa fa-fw fa-building',

View File

@ -19,6 +19,9 @@ Ext.define('PVE.storage.RBDInputPanel', {
initComponent : function() {
var me = this;
if (!me.nodename) {
me.nodename = 'localhost';
}
me.column1 = [
{
@ -28,32 +31,47 @@ Ext.define('PVE.storage.RBDInputPanel', {
fieldLabel: 'ID',
vtype: 'StorageId',
allowBlank: false
},
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'pool',
value: 'rbd',
fieldLabel: gettext('Pool'),
allowBlank: false
},
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'monhost',
vtype: 'HostList',
value: '',
fieldLabel: 'Monitor(s)',
allowBlank: false
},
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'username',
value: me.isCreate ? 'admin': '',
fieldLabel: gettext('User name'),
allowBlank: true
}
];
// here value is an array,
if (me.pveceph) {
me.column1.push(
{
xtype: me.isCreate ? 'pveCephPoolSelector' : 'displayfield',
nodename: me.nodename,
name: 'pool',
fieldLabel: gettext('Pool'),
allowBlank: false
}
);
} else {
me.column1.push(
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'pool',
value: 'rbd',
fieldLabel: gettext('Pool'),
allowBlank: false
},
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'monhost',
vtype: 'HostList',
value: '',
fieldLabel: 'Monitor(s)',
allowBlank: false
},
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'username',
value: me.isCreate ? 'admin': '',
fieldLabel: gettext('User name'),
allowBlank: true
}
);
}
// here value is an array,
// while before it was a string
/*jslint confusion: true*/
me.column2 = [
@ -116,11 +134,13 @@ Ext.define('PVE.storage.RBDEdit', {
var ipanel = Ext.create('PVE.storage.RBDInputPanel', {
isCreate: me.isCreate,
storageId: me.storageId
storageId: me.storageId,
nodename: me.nodename,
pveceph: me.pveceph
});
Ext.apply(me, {
subject: PVE.Utils.format_storage_type('rbd'),
subject: PVE.Utils.format_storage_type(me.pveceph?'pveceph':'rbd'),
isAdd: true,
items: [ ipanel ]
});