[pve-devel] [PATCH manager v2 3/5] add new "RBD (PVE)" storage choice

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Sep 7 12:38:11 CEST 2017


On Thu, Sep 07, 2017 at 12:34:02PM +0200, Dominik Csapak wrote:
> 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)" in the storage panel
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> changes from v1:
> * added logic to display only 'RBD' on a storage summary, because
>   we cannot differentiate between a pve managed storage and an external
>   one there

please rebase, v1 has already been applied

>  www/manager6/Utils.js           |  9 +++++-
>  www/manager6/dc/StorageView.js  | 16 ++++++++--
>  www/manager6/storage/RBDEdit.js | 70 ++++++++++++++++++++++++++---------------
>  3 files changed, 67 insertions(+), 28 deletions(-)
> 
> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
> index fecf9aff..0d4217d4 100644
> --- a/www/manager6/Utils.js
> +++ b/www/manager6/Utils.js
> @@ -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) {
> +	    value = (record.get('monhost')?'rbd_ext':'pveceph');
> +	}
>  	if (value === 'dir') {
>  	    return PVE.Utils.directoryText;
>  	} else if (value === 'nfs') {
> @@ -790,6 +793,10 @@ Ext.define('PVE.Utils', { utilities: {
>  	    return 'iSCSI';
>  	} else if (value === 'rbd') {
>  	    return 'RBD';
> +	} else if (value === 'rbd_ext') {
> +	    return 'RBD (external)';
> +	} else if (value === 'pveceph') {
> +	    return 'RBD (PVE)';
>  	} else if (value === 'sheepdog') {
>  	    return 'Sheepdog';
>  	} else if (value === 'zfs') {
> diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
> index 2940a98f..8f5a055c 100644
> --- a/www/manager6/dc/StorageView.js
> +++ b/www/manager6/dc/StorageView.js
> @@ -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();
> @@ -166,7 +167,18 @@ Ext.define('PVE.dc.StorageView', {
>  				}
>  			    },
>  			    {
> -				text: PVE.Utils.format_storage_type('rbd'),
> +				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_ext'),
>  				iconCls: 'fa fa-fw fa-building',
>  				handler: function() {
>  				    var win = Ext.create('PVE.storage.RBDEdit', {});
> diff --git a/www/manager6/storage/RBDEdit.js b/www/manager6/storage/RBDEdit.js
> index 64776e6e..55ac8541 100644
> --- a/www/manager6/storage/RBDEdit.js
> +++ b/www/manager6/storage/RBDEdit.js
> @@ -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 ]
>  	});
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list