fix #5570 ui: ceph: make MDS ID configurable

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>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: use camelCase for local serviceID variable ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Aaron Lauterer 2024-07-10 14:43:00 +02:00 committed by Thomas Lamprecht
parent 9477cb4b76
commit 0fd676f902

View File

@ -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 serviceID = me.serviceID ?? me.nodename;
me.url = `/nodes/${node}/ceph/${me.type}/${node}${extraID}`;
me.url = `/nodes/${node}/ceph/${me.type}/${serviceID}`;
},
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.'),
},
],