]> git.proxmox.com Git - pve-manager.git/commitdiff
ceph: pool: make min_size constrain check more general
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 12:19:50 +0000 (14:19 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 12:19:50 +0000 (14:19 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/ceph/Pool.js

index 9645431dc4467cefb4766cb5cc792e0ed4161368..678639663643aa2a15c2d7a6590d725960424b0b 100644 (file)
@@ -79,17 +79,18 @@ Ext.define('PVE.CephPoolInputPanel', {
            maxValue: 7,
            allowBlank: false,
            listeners: {
-               change: function(field, val) {
-                   let warn = true;
-                   let warn_text = gettext('Min. Size');
+               change: function(field, minSize) {
+                   let panel = field.up('inputpanel');
+                   let size = panel.down('field[name=size]').getValue();
 
-                   if (val < 2) {
-                       warn = false;
-                       warn_text = gettext('Min. Size') + ' <i class="fa fa-exclamation-triangle warning"></i>';
-                   }
+                   let showWarning = minSize <= size / 2 && minSize !== size;
 
-                   field.up().down('field[name=min_size-warning]').setHidden(warn);
-                   field.setFieldLabel(warn_text);
+                   let fieldLabel = gettext('Min. Size');
+                   if (showWarning) {
+                       fieldLabel = gettext('Min. Size') + ' <i class="fa fa-exclamation-triangle warning"></i>';
+                   }
+                   panel.down('field[name=min_size-warning]').setHidden(!showWarning);
+                   field.setFieldLabel(fieldLabel);
                },
            },
        },
@@ -97,7 +98,7 @@ Ext.define('PVE.CephPoolInputPanel', {
            xtype: 'displayfield',
            name: 'min_size-warning',
            userCls: 'pmx-hint',
-           value: 'A pool with min_size=1 could lead to data loss, incomplete PGs or unfound objects.',
+           value: gettext('min_size <= size/2 can lead to data loss, incomplete PGs or unfound objects.'),
            hidden: true,
        },
        {