From 2d6c2886a74c89698985a21bd7caf282cb15e6de Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 17 Mar 2023 11:22:07 +0100 Subject: [PATCH] fix #4571: ui: ceph: allow adding extra-ID for multiple MDS per node One MDS can only serve a single CephFS at a time and for redundancy one wants to have standby's on other nodes. But with multiple CephFS instances a single MDS per node might not be enough, e.g., with three FS on a three-node cluster a failure of one node would mean that on CephFS won't work anymore. While the API and CLI allowed to set up multiple CephFS per node already, the UI didn't. Address this by adding an `Extra ID` field that will be suffixed to the base ID, which always contains the node as that makes sorting and also associating services to their node easier. Signed-off-by: Thomas Lamprecht --- www/manager6/ceph/ServiceList.js | 66 +++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/www/manager6/ceph/ServiceList.js b/www/manager6/ceph/ServiceList.js index 8b51fe6a..76710146 100644 --- a/www/manager6/ceph/ServiceList.js +++ b/www/manager6/ceph/ServiceList.js @@ -1,25 +1,42 @@ Ext.define('PVE.CephCreateService', { extend: 'Proxmox.window.Edit', + mixins: ['Proxmox.Mixin.CBind'], xtype: 'pveCephCreateService', - showProgress: true, - - setNode: function(nodename) { - let me = this; - me.nodename = nodename; - me.url = `/nodes/${nodename}/ceph/${me.type}/${nodename}`; - }, - method: 'POST', isCreate: true, + showProgress: true, + width: 450, + setNode: function(node) { + let me = this; + me.nodename = node; + me.updateUrl(); + }, + setExtraID: function(extraID) { + let me = this; + me.extraID = me.type === 'mds' ? `-${extraID}` : ''; + me.updateUrl(); + }, + updateUrl: function() { + let me = this; + + let extraID = me.extraID ?? ''; + let node = me.nodename; + + me.url = `/nodes/${node}/ceph/${me.type}/${node}${extraID}`; + }, + + defaults: { + labelWidth: 75, + }, items: [ { xtype: 'pveNodeSelector', - submitValue: false, fieldLabel: gettext('Host'), selectCurNode: true, allowBlank: false, + submitValue: false, listeners: { change: function(f, value) { let view = this.up('pveCephCreateService'); @@ -27,6 +44,37 @@ Ext.define('PVE.CephCreateService', { }, }, }, + { + xtype: 'textfield', + fieldLabel: gettext('Extra ID'), + regex: /[a-zA-Z0-9]+/, + regexText: gettext('ID may only consist of alphanumeric characters'), + submitValue: false, + emptyText: Proxmox.Utils.NoneText, + cbind: { + disabled: get => get('type') !== 'mds', + hidden: get => get('type') !== 'mds', + }, + listeners: { + change: function(f, value) { + let view = this.up('pveCephCreateService'); + view.setExtraID(value); + }, + }, + }, + { + xtype: 'component', + border: false, + padding: '5 2', + style: { + fontSize: '12px', + }, + userCls: 'pmx-hint', + cbind: { + hidden: get => get('type') !== 'mds', + }, + html: gettext('The Extra ID allows creating multiple MDS per node, which increases redundancy with more than one CephFS.'), + }, ], initComponent: function() {