[pve-devel] [PATCH manager] ui: RBDStorage: add field for RBD namespace

Aaron Lauterer a.lauterer at proxmox.com
Fri Apr 16 16:10:26 CEST 2021


Makes it possible to configure the RBD namespace via the GUI.

RBD namespaces must be configured manually. The most likely use case is
when connecting to an external Ceph cluster as this makes it possible to
separate client PVE clusters by namespace, not by pool.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
Right now the warning field is below the checkbox to select between
external or hyperconverged ceph.

I wasn't sure which position would be better. Above that checkbox or
directly below the namespace field (same column)?

 www/manager6/storage/RBDEdit.js | 56 +++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 13 deletions(-)

diff --git a/www/manager6/storage/RBDEdit.js b/www/manager6/storage/RBDEdit.js
index be29dc8a..fad9305b 100644
--- a/www/manager6/storage/RBDEdit.js
+++ b/www/manager6/storage/RBDEdit.js
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.Ceph.Model', {
     data: {
 	pveceph: true,
 	pvecephPossible: true,
+	namespacePresent: false,
     },
 });
 
@@ -26,10 +27,18 @@ Ext.define('PVE.storage.Ceph.Controller', {
 	    disable: 'resetField',
 	    enable: 'resetField',
 	},
+	'textfield[name=namespace]': {
+	    change: 'updateNamespaceHint',
+	},
     },
     resetField: function(field) {
 	field.reset();
     },
+    updateNamespaceHint(field, newVal, oldVal) {
+	var vm = this.getViewModel();
+	let namespacePresent = newVal? true : false;
+	vm.set('namespacePresent', namespacePresent);
+    },
     queryMonitors: function(field, newVal, oldVal) {
 	// we get called with two signatures, the above one for a field
 	// change event and the afterrender from the view, this check only
@@ -88,6 +97,9 @@ Ext.define('PVE.storage.RBDInputPanel', {
 	    this.lookupReference('pvecephRef').setValue(false);
 	    this.lookupReference('pvecephRef').resetOriginalValue();
 	}
+	if (values.namespace) {
+	    this.viewModel.set('namespacePresent', true);
+	}
 	this.callParent([values]);
     },
 
@@ -170,6 +182,13 @@ Ext.define('PVE.storage.RBDInputPanel', {
 		fieldLabel: gettext('User name'),
 		allowBlank: true,
 	    },
+	    {
+		xtype: me.isCreate ? 'textfield' : 'displayfield',
+		name: 'namespace',
+		value: '',
+		fieldLabel: gettext('Namespace'),
+		allowBlank: true,
+	    },
 	);
 
 	me.column2 = [
@@ -190,20 +209,31 @@ Ext.define('PVE.storage.RBDInputPanel', {
 	    },
 	];
 
-	me.columnB = [{
-	    xtype: 'proxmoxcheckbox',
-	    name: 'pveceph',
-	    reference: 'pvecephRef',
-	    bind: {
-		disabled: '{!pvecephPossible}',
-		value: '{pveceph}',
+	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 ceph pool'),
+	    },
+	    {
+		xtype: 'displayfield',
+		name: 'namespace-hint',
+		userCls: 'pmx-hint',
+		value: gettext('RBD namespaces must be created manually!'),
+		bind: {
+		    hidden: '{!namespacePresent}',
+		},
 	    },
-	    checked: true,
-	    uncheckedValue: 0,
-	    submitValue: false,
-	    hidden: !me.isCreate,
-	    boxLabel: gettext('Use Proxmox VE managed hyper-converged ceph pool'),
-	}];
+	];
 
 	me.callParent();
     },
-- 
2.20.1






More information about the pve-devel mailing list