]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: RBDStorage: add field for RBD namespace
authorAaron Lauterer <a.lauterer@proxmox.com>
Mon, 19 Apr 2021 07:52:25 +0000 (09:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 26 Apr 2021 18:10:47 +0000 (20:10 +0200)
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@proxmox.com>
www/manager6/storage/RBDEdit.js

index be29dc8a57952b05e2110f1f426fbd3c4d716c7a..c55a05c0efa3d2cbd56e6e34746ea5d9e66434ac 100644 (file)
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.Ceph.Model', {
     data: {
        pveceph: true,
        pvecephPossible: true,
+       namespacePresent: false,
     },
 });
 
@@ -26,10 +27,16 @@ Ext.define('PVE.storage.Ceph.Controller', {
            disable: 'resetField',
            enable: 'resetField',
        },
+       'textfield[name=namespace]': {
+           change: 'updateNamespaceHint',
+       },
     },
     resetField: function(field) {
        field.reset();
     },
+    updateNamespaceHint: function(field, newVal, oldVal) {
+       this.getViewModel().set('namespacePresent', newVal);
+    },
     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 +95,9 @@ Ext.define('PVE.storage.RBDInputPanel', {
            this.lookupReference('pvecephRef').setValue(false);
            this.lookupReference('pvecephRef').resetOriginalValue();
        }
+       if (values.namespace) {
+           this.getViewModel().set('namespacePresent', true);
+       }
        this.callParent([values]);
     },
 
@@ -170,6 +180,14 @@ Ext.define('PVE.storage.RBDInputPanel', {
                fieldLabel: gettext('User name'),
                allowBlank: true,
            },
+           {
+               xtype: 'pmxDisplayEditField',
+               editable: me.isCreate,
+               name: 'namespace',
+               value: '',
+               fieldLabel: gettext('Namespace'),
+               allowBlank: true,
+           },
        );
 
        me.column2 = [
@@ -190,20 +208,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'),
            },
-           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}',
+               },
+           },
+       ];
 
        me.callParent();
     },