ui: improve ZFS pool name validator accuracy
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
a75caed794
commit
f39b06d7fa
@ -46,10 +46,17 @@ Ext.define('PVE.node.CreateZFS', {
|
|||||||
name: 'name',
|
name: 'name',
|
||||||
fieldLabel: gettext('Name'),
|
fieldLabel: gettext('Name'),
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
|
maxLength: 128, // ZFS_MAX_DATASET_NAME_LEN is (256 - some edge case)
|
||||||
|
validator: v => {
|
||||||
// see zpool_name_valid function in libzfs_zpool.c
|
// see zpool_name_valid function in libzfs_zpool.c
|
||||||
validator: v => v.match(/^(mirror|raidz|draid|spare)/) || v === 'log'
|
if (v.match(/^(mirror|raidz|draid|spare)/) || v === 'log') {
|
||||||
? gettext('Cannot use reserved pool name')
|
return gettext('Cannot use reserved pool name');
|
||||||
: true,
|
} else if (!v.match(/^[a-zA-Z][a-zA-Z0-9\-_.]*$/)) {
|
||||||
|
// note: zfs would support also : and whitespace, but we don't
|
||||||
|
return gettext("Invalid characters in pool name");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxcheckbox',
|
xtype: 'proxmoxcheckbox',
|
||||||
|
Loading…
Reference in New Issue
Block a user