all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range
@ 2026-11-23 15:20 Michael Köppl
  2026-11-23 15:20 ` [PATCH cluster 1/2] " Michael Köppl
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Michael Köppl @ 2026-11-23 15:20 UTC (permalink / raw)
  To: pve-devel

The upper boundary of the next-id range is exclusive, but the
datacenter config only rejected a lower boundary above the upper one.
Setting both to the same value was accepted and left no guest ID in
the range, so requesting the next free guest ID always failed.

1/2 fixes the check when writing datacenter.cfg, which covers API and
CLI. 2/2 adds the check in the edit window in the web UI, so that users
are already stopped from entering such a value in the web UI.


cluster:

Michael Köppl (1):
  datacenter config: next-id: reject an empty range

 src/PVE/DataCenterConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


manager:

Michael Köppl (1):
  ui: dc options: next-id: require upper to be above lower

 www/manager6/dc/OptionView.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)


Summary over all repositories:
  2 files changed, 14 insertions(+), 1 deletions(-)

-- 
Generated by murpp 0.12.1




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH cluster 1/2] datacenter config: next-id: reject an empty range
  2026-11-23 15:20 [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Michael Köppl
@ 2026-11-23 15:20 ` Michael Köppl
  2026-11-24  6:44   ` Dominik Rusovac
  2026-11-23 15:21 ` [PATCH manager 2/2] ui: dc options: next-id: require upper to be above lower Michael Köppl
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Michael Köppl @ 2026-11-23 15:20 UTC (permalink / raw)
  To: pve-devel

The upper boundary of the next-id range is exclusive, but writing the
config only rejected a lower boundary above the upper one. Setting both
to the same value was accepted and left no guest ID in the range.
Requesting the next free guest ID would then always fail. With enforce
set, every guest ID was rejected.

Adapt the condition to check that the value of the upper bound is
strictly greater than the value of the lower bound.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 src/PVE/DataCenterConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/DataCenterConfig.pm b/src/PVE/DataCenterConfig.pm
index 9829241..5ea0587 100644
--- a/src/PVE/DataCenterConfig.pm
+++ b/src/PVE/DataCenterConfig.pm
@@ -767,7 +767,7 @@ sub write_datacenter_config {
         my $lower = int($next_id->{lower} // $next_id_format->{lower}->{default});
         my $upper = int($next_id->{upper} // $next_id_format->{upper}->{default});
 
-        die "lower ($lower) <= upper ($upper) boundary rule broken\n" if $lower > $upper;
+        die "lower ($lower) < upper ($upper) boundary rule broken\n" if $lower >= $upper;
 
         $cfg->{'next-id'} = PVE::JSONSchema::print_property_string($next_id, $next_id_format);
     }
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH manager 2/2] ui: dc options: next-id: require upper to be above lower
  2026-11-23 15:20 [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Michael Köppl
  2026-11-23 15:20 ` [PATCH cluster 1/2] " Michael Köppl
@ 2026-11-23 15:21 ` Michael Köppl
  2026-11-24  7:15   ` Dominik Rusovac
  2026-11-24  7:41 ` [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Dominik Rusovac
  2026-11-24  9:47 ` Thomas Lamprecht
  3 siblings, 1 reply; 7+ messages in thread
From: Michael Köppl @ 2026-11-23 15:21 UTC (permalink / raw)
  To: pve-devel

The backend rejects a next-id range whose exclusive upper boundary is
not above the lower one. Check this in the window already, so that users
see the error at the field instead of only after submitting.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 www/manager6/dc/OptionView.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index 19e6d54e..e9e88758 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -372,6 +372,10 @@ Ext.define('PVE.dc.OptionView', {
                     minValue: 100,
                     maxValue: 1000 * 1000 * 1000 - 1,
                     submitValue: true,
+                    listeners: {
+                        change: (field) =>
+                            field.up('inputpanel').down('field[name=upper]').validate(),
+                    },
                 },
                 {
                     xtype: 'proxmoxintegerfield',
@@ -381,6 +385,15 @@ Ext.define('PVE.dc.OptionView', {
                     minValue: 100,
                     maxValue: 1000 * 1000 * 1000 - 1,
                     submitValue: true,
+                    validator: function () {
+                        let lower =
+                            this.up('inputpanel').down('field[name=lower]').getValue() ?? 100;
+                        let upper = this.getValue() ?? 1000 * 1000;
+                        if (upper <= lower) {
+                            return gettext('Must be greater than the lower boundary');
+                        }
+                        return true;
+                    },
                 },
                 {
                     xtype: 'proxmoxcheckbox',
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH cluster 1/2] datacenter config: next-id: reject an empty range
  2026-11-23 15:20 ` [PATCH cluster 1/2] " Michael Köppl
@ 2026-11-24  6:44   ` Dominik Rusovac
  0 siblings, 0 replies; 7+ messages in thread
From: Dominik Rusovac @ 2026-11-24  6:44 UTC (permalink / raw)
  To: Michael Köppl, pve-devel

lgtm, consider as:

Reviewed-by: Dominik Rusovac <d.rusovac@proxmox.com>

On Mon Nov 23, 2026 at 4:20 PM CET, Michael Köppl wrote:
> The upper boundary of the next-id range is exclusive, but writing the
> config only rejected a lower boundary above the upper one. Setting both
> to the same value was accepted and left no guest ID in the range.
> Requesting the next free guest ID would then always fail. With enforce
> set, every guest ID was rejected.
>
> Adapt the condition to check that the value of the upper bound is
> strictly greater than the value of the lower bound.
>
> Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
> ---
>  src/PVE/DataCenterConfig.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/PVE/DataCenterConfig.pm b/src/PVE/DataCenterConfig.pm
> index 9829241..5ea0587 100644
> --- a/src/PVE/DataCenterConfig.pm
> +++ b/src/PVE/DataCenterConfig.pm
> @@ -767,7 +767,7 @@ sub write_datacenter_config {
>          my $lower = int($next_id->{lower} // $next_id_format->{lower}->{default});
>          my $upper = int($next_id->{upper} // $next_id_format->{upper}->{default});
>  
> -        die "lower ($lower) <= upper ($upper) boundary rule broken\n" if $lower > $upper;
> +        die "lower ($lower) < upper ($upper) boundary rule broken\n" if $lower >= $upper;
>  
>          $cfg->{'next-id'} = PVE::JSONSchema::print_property_string($next_id, $next_id_format);
>      }





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH manager 2/2] ui: dc options: next-id: require upper to be above lower
  2026-11-23 15:21 ` [PATCH manager 2/2] ui: dc options: next-id: require upper to be above lower Michael Köppl
@ 2026-11-24  7:15   ` Dominik Rusovac
  0 siblings, 0 replies; 7+ messages in thread
From: Dominik Rusovac @ 2026-11-24  7:15 UTC (permalink / raw)
  To: Michael Köppl, pve-devel

one nit inline

consider as:

Reviewed-by: Dominik Rusovac <d.rusovac@proxmox.com>

On Mon Nov 23, 2026 at 4:21 PM CET, Michael Köppl wrote:
> The backend rejects a next-id range whose exclusive upper boundary is
> not above the lower one. Check this in the window already, so that users
> see the error at the field instead of only after submitting.
>
> Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
> ---
>  www/manager6/dc/OptionView.js | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
> index 19e6d54e..e9e88758 100644
> --- a/www/manager6/dc/OptionView.js
> +++ b/www/manager6/dc/OptionView.js
> @@ -372,6 +372,10 @@ Ext.define('PVE.dc.OptionView', {
>                      minValue: 100,
>                      maxValue: 1000 * 1000 * 1000 - 1,
>                      submitValue: true,
> +                    listeners: {
> +                        change: (field) =>
> +                            field.up('inputpanel').down('field[name=upper]').validate(),
> +                    },
>                  },
>                  {
>                      xtype: 'proxmoxintegerfield',
> @@ -381,6 +385,15 @@ Ext.define('PVE.dc.OptionView', {
>                      minValue: 100,
>                      maxValue: 1000 * 1000 * 1000 - 1,
>                      submitValue: true,
> +                    validator: function () {
> +                        let lower =
> +                            this.up('inputpanel').down('field[name=lower]').getValue() ?? 100;
> +                        let upper = this.getValue() ?? 1000 * 1000;
> +                        if (upper <= lower) {
> +                            return gettext('Must be greater than the lower boundary');
> +                        }
> +                        return true;
> +                    },
>                  },
>                  {
>                      xtype: 'proxmoxcheckbox',

nit: to increase readability and maintainabiliy, it could make sense to
use named constants for the min, max and default values as a single
source of truth here

but this is not a blocker




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range
  2026-11-23 15:20 [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Michael Köppl
  2026-11-23 15:20 ` [PATCH cluster 1/2] " Michael Köppl
  2026-11-23 15:21 ` [PATCH manager 2/2] ui: dc options: next-id: require upper to be above lower Michael Köppl
@ 2026-11-24  7:41 ` Dominik Rusovac
  2026-11-24  9:47 ` Thomas Lamprecht
  3 siblings, 0 replies; 7+ messages in thread
From: Dominik Rusovac @ 2026-11-24  7:41 UTC (permalink / raw)
  To: Michael Köppl, pve-devel

On Mon Nov 23, 2026 at 4:20 PM CET, Michael Köppl wrote:
> The upper boundary of the next-id range is exclusive, but the
> datacenter config only rejected a lower boundary above the upper one.
> Setting both to the same value was accepted and left no guest ID in
> the range, so requesting the next free guest ID always failed.
>
> 1/2 fixes the check when writing datacenter.cfg, which covers API and
> CLI. 2/2 adds the check in the edit window in the web UI, so that users
> are already stopped from entering such a value in the web UI.

I tested that:
* users are already stopped from entering equal bounds in the web UI
* all of the following are rejected because of a broken lower < upper boundary rule:
  * `pvesh set /cluster/options --next-id lower=n,upper=n`
  * `pvesh set /cluster/options --next-id lower=n+1,upper=n` 
* `pvesh set /cluster/options --next-id lower=n,upper=n+1` is still accepted
* `pvesh set /cluster/options --next-id lower=1000000` is rejected,
   since default upper bound is 1000000, hence setting lower=1000000
   gives lower=upper and should result in broken rule

[snip]

Reviewed-by: Dominik Rusovac <d.rusovac@proxmox.com>
Tested-by: Dominik Rusovac <d.rusovac@proxmox.com>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range
  2026-11-23 15:20 [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Michael Köppl
                   ` (2 preceding siblings ...)
  2026-11-24  7:41 ` [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Dominik Rusovac
@ 2026-11-24  9:47 ` Thomas Lamprecht
  3 siblings, 0 replies; 7+ messages in thread
From: Thomas Lamprecht @ 2026-11-24  9:47 UTC (permalink / raw)
  To: pve-devel, Michael Köppl

On Mon, 23 Nov 2026 16:20:58 +0100, Michael Köppl wrote:
> The upper boundary of the next-id range is exclusive, but the
> datacenter config only rejected a lower boundary above the upper one.
> Setting both to the same value was accepted and left no guest ID in
> the range, so requesting the next free guest ID always failed.
> 
> 1/2 fixes the check when writing datacenter.cfg, which covers API and
> CLI. 2/2 adds the check in the edit window in the web UI, so that users
> are already stopped from entering such a value in the web UI.
> 
> [...]

Applied, thanks!

The check also runs when any other datacenter option gets changed, so
the error now says which option it is about, e.g. "next-id: upper
boundary (100) must be greater than lower boundary (100)".

In the UI, upper field minium now starts at 101 and goes up to the
backend maximum, as the exclusive upper boundary must be above the
lowest and may be above the highest guest ID. Also added a test for the
range boundaries.

[cluster] applied to pve-cluster.git (master)
[1/1] datacenter config: next-id: reject an empty range
      https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff;h=321e188b753b0e746da97d67d28c604df4c29cc1

[manager] applied to pve-manager.git (master)
[1/1] ui: dc options: next-id: require upper to be above lower
      https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=2ca4ed3dba020607326da7c6fbdc2d7e228ff282




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-24 10:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 15:20 [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Michael Köppl
2026-11-23 15:20 ` [PATCH cluster 1/2] " Michael Köppl
2026-11-24  6:44   ` Dominik Rusovac
2026-11-23 15:21 ` [PATCH manager 2/2] ui: dc options: next-id: require upper to be above lower Michael Köppl
2026-11-24  7:15   ` Dominik Rusovac
2026-11-24  7:41 ` [PATCH cluster/manager 0/2] datacenter config: next-id: reject an empty range Dominik Rusovac
2026-11-24  9:47 ` Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal