From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id F20F41FF2C6
	for <inbox@lore.proxmox.com>; Wed, 10 Jul 2024 14:42:46 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 80F2594EB;
	Wed, 10 Jul 2024 14:43:05 +0200 (CEST)
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 10 Jul 2024 14:43:00 +0200
Message-Id: <20240710124300.295817-3-a.lauterer@proxmox.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20240710124300.295817-1-a.lauterer@proxmox.com>
References: <20240710124300.295817-1-a.lauterer@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.040 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [ceph.com]
Subject: [pve-devel] [PATCH manager 2/2] fix#5570 ui: ceph: make MDS ID
 configurable
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Since the ID of an MDS cannot start with a number [0], we cannot just
use the hostname in all situations, as they are allowed to start with a
number.

By having an extra field for the MDS ID, we can check for that via a
regex. This field is filled with the hostname when the host on which it
should be installed is selected.

This means, we can remove the extra ID field, as additional MDS, and
their unique ID can be set with the new ID field.

[0] https://docs.ceph.com/en/latest/man/8/ceph-mds/

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 www/manager6/ceph/ServiceList.js | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/www/manager6/ceph/ServiceList.js b/www/manager6/ceph/ServiceList.js
index 76710146..9075f197 100644
--- a/www/manager6/ceph/ServiceList.js
+++ b/www/manager6/ceph/ServiceList.js
@@ -13,18 +13,17 @@ Ext.define('PVE.CephCreateService', {
 	me.nodename = node;
 	me.updateUrl();
     },
-    setExtraID: function(extraID) {
+    setServiceID: function(value) {
 	let me = this;
-	me.extraID = me.type === 'mds' ? `-${extraID}` : '';
+	me.serviceID = value;
 	me.updateUrl();
     },
     updateUrl: function() {
 	let me = this;
-
-	let extraID = me.extraID ?? '';
 	let node = me.nodename;
+	let service_id = me.serviceID ?? me.nodename;
 
-	me.url = `/nodes/${node}/ceph/${me.type}/${node}${extraID}`;
+	me.url = `/nodes/${node}/ceph/${me.type}/${service_id}`;
     },
 
     defaults: {
@@ -40,15 +39,17 @@ Ext.define('PVE.CephCreateService', {
 	    listeners: {
 		change: function(f, value) {
 		    let view = this.up('pveCephCreateService');
+		    view.lookup('mds-id').setValue(value);
 		    view.setNode(value);
 		},
 	    },
 	},
 	{
 	    xtype: 'textfield',
-	    fieldLabel: gettext('Extra ID'),
-	    regex: /[a-zA-Z0-9]+/,
-	    regexText: gettext('ID may only consist of alphanumeric characters'),
+	    reference: 'mds-id',
+	    fieldLabel: gettext('MDS ID'),
+	    regex: /^([a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?)$/,
+	    regexText: gettext('ID may consist of alphanumeric characters and hyphen. It cannot start with a number or end in a hyphen.'),
 	    submitValue: false,
 	    emptyText: Proxmox.Utils.NoneText,
 	    cbind: {
@@ -58,7 +59,7 @@ Ext.define('PVE.CephCreateService', {
 	    listeners: {
 		change: function(f, value) {
 		    let view = this.up('pveCephCreateService');
-		    view.setExtraID(value);
+		    view.setServiceID(value);
 		},
 	    },
 	},
@@ -73,7 +74,7 @@ Ext.define('PVE.CephCreateService', {
 	    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.'),
+	    html: gettext('By using different IDs, you can have multiple MDS per node, which increases redundancy with more than one CephFS.'),
 	},
     ],
 
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel