[pve-devel] [PATCH manager 3/3] ui: dc/storage: allow to add CephFS

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 15 13:20:11 CET 2018


Allow to add CephFS storage over GUI. Reuse viewcontroller and model from RBD
to detect if we can do a "hyper-converged" addition (with PVE maintained Ceph)
or if only external is possible.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/Makefile              |  1 +
 www/manager6/Utils.js              | 17 +++++-
 www/manager6/storage/CephFSEdit.js | 95 ++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+), 2 deletions(-)
 create mode 100644 www/manager6/storage/CephFSEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index cc2f7203..f5667f32 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -171,6 +171,7 @@ JSSRC= 				                 	\
 	storage/IScsiEdit.js				\
 	storage/LVMEdit.js				\
 	storage/LvmThinEdit.js				\
+	storage/CephFSEdit.js				\
 	storage/RBDEdit.js				\
 	storage/SheepdogEdit.js				\
 	storage/ZFSEdit.js				\
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index bbc6fe08..49b5786a 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -483,6 +483,17 @@ Ext.define('PVE.Utils', { utilities: {
 	    hideAdd: true,
 	    faIcon: 'building'
 	},
+	cephfs: {
+	    name: 'CephFS',
+	    ipanel: 'CephFSInputPanel',
+	    faIcon: 'building'
+	},
+	pvecephfs: {
+	    name: 'CephFS (PVE)',
+	    ipanel: 'CephFSInputPanel',
+	    hideAdd: true,
+	    faIcon: 'building'
+	},
 	rbd: {
 	    name: 'RBD',
 	    ipanel: 'RBDInputPanel',
@@ -511,8 +522,10 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     format_storage_type: function(value, md, record) {
-	if (value === 'rbd' && record) {
-	    value = (record.get('monhost') ? 'rbd' : 'pveceph');
+	if (value === 'rbd') {
+	    value = (!record || record.get('monhost') ? 'rbd' : 'pveceph');
+	} else if (value === 'cephfs') {
+	    value = (!record || record.get('monhost') ? 'cephfs' : 'pvecephfs');
 	}
 
 	var schema = PVE.Utils.storageSchema[value];
diff --git a/www/manager6/storage/CephFSEdit.js b/www/manager6/storage/CephFSEdit.js
new file mode 100644
index 00000000..0580e8fc
--- /dev/null
+++ b/www/manager6/storage/CephFSEdit.js
@@ -0,0 +1,95 @@
+/*jslint confusion: true*/
+Ext.define('PVE.storage.CephFSInputPanel', {
+    extend: 'PVE.panel.StorageBase',
+    controller: 'cephstorage',
+
+    viewModel: {
+	type: 'cephstorage'
+    },
+
+    setValues: function(values) {
+	if (values.monhost) {
+	    this.viewModel.set('pveceph', false);
+	    this.lookupReference('pvecephRef').setValue(false);
+	    this.lookupReference('pvecephRef').resetOriginalValue();
+	}
+	this.callParent([values]);
+    },
+
+    initComponent : function() {
+	var me = this;
+
+	if (!me.nodename) {
+	    me.nodename = 'localhost';
+	}
+	me.type = 'cephfs';
+
+	me.column1 = [];
+
+	me.column1.push(
+	    {
+		xtype: 'textfield',
+		name: 'monhost',
+		vtype: 'HostList',
+		value: '',
+		bind: {
+		    disabled: '{pveceph}',
+		    submitValue: '{!pveceph}',
+		    hidden: '{pveceph}'
+		},
+		fieldLabel: 'Monitor(s)',
+		allowBlank: false
+	    },
+	    {
+		xtype: 'displayfield',
+		reference: 'monhost',
+		bind: {
+		    disabled: '{!pveceph}',
+		    hidden: '{!pveceph}'
+		},
+		value: '',
+		fieldLabel: 'Monitor(s)'
+	    },
+	    {
+		xtype: me.isCreate ? 'textfield' : 'displayfield',
+		name: 'username',
+		value: 'admin',
+		bind:  {
+		    disabled: '{pveceph}',
+		    submitValue: '{!pveceph}'
+		},
+		fieldLabel: gettext('User name'),
+		allowBlank: true
+	    }
+	);
+
+	me.column2 = [
+	    {
+		xtype: 'pveContentTypeSelector',
+		cts: ['backup', 'iso', 'vztmpl'],
+		fieldLabel: gettext('Content'),
+		name: 'content',
+		value: ['backup'],
+		multiSelect: true,
+		allowBlank: false
+	    }
+	];
+
+	me.columnB = [{
+	    xtype: 'proxmoxcheckbox',
+	    name: 'pveceph',
+	    reference: 'pvecephRef',
+	    bind : {
+		disabled: '{!pvecephPossible}',
+		value: '{pveceph}'
+	    },
+	    checked: true,
+	    uncheckedValue: 0,
+	    submitValue: false,
+	    hidden: !me.isCreate,
+	    boxLabel: gettext('Use Proxmox VE managed hyper-converged cephFS')
+	}];
+
+	me.callParent();
+    }
+});
-- 
2.19.1





More information about the pve-devel mailing list