all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH] section config: update schema: drop unusable global properties
@ 2026-07-15 12:19 Dietmar Maurer
  0 siblings, 0 replies; only message in thread
From: Dietmar Maurer @ 2026-07-15 12:19 UTC (permalink / raw)
  To: pve-devel

With property isolation, updateSchema() added every global property
to the schema, even those that no plugin references in options() and
those that are only referenced as fixed. Both get rejected by
check_config() on update anyway - as unexpected property, or because
fixed parameters cannot be changed - so the schema merely advertised
update parameters that can never work. Skip them, like unified mode
already does.

The required globals stay: the section ID, and the type, which update
requests carry so that schema validation can pick the matching
variant of same-named per-type properties; check_value() checks it
against the section's actual type.

Adjust the test fixture that encoded the old behavior.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
 src/PVE/SectionConfig.pm                     |  6 ++++++
 test/SectionConfig/schema_comparison_test.pl | 10 +++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm
index 84ff81a..49ebf67 100644
--- a/src/PVE/SectionConfig.pm
+++ b/src/PVE/SectionConfig.pm
@@ -655,8 +655,14 @@ sub updateSchema {
             }
         }
 
+        # the loop above already covered all modifiable properties, optional
+        # global ones are only usable by a plugin when referenced in its
+        # options(); so only add the required globals, i.e. the section ID and
+        # the type, which update requests carry so the matching variant of
+        # per-type properties can be selected during schema validation
         for my $opt (keys $propertyList->%*) {
             next if $props->{$opt};
+            next if $propertyList->{$opt}->{optional};
             $props->{$opt} = { $propertyList->{$opt}->%* };
         }
 
diff --git a/test/SectionConfig/schema_comparison_test.pl b/test/SectionConfig/schema_comparison_test.pl
index 3ae8551..f421ed3 100755
--- a/test/SectionConfig/schema_comparison_test.pl
+++ b/test/SectionConfig/schema_comparison_test.pl
@@ -540,9 +540,9 @@ package OptionalCommonUnused {
 
     sub desc($class) {
         return
-            "in unified mode, optional default properties that plugins"
-            . " do not declare in options() are *not* included in updateSchema"
-            . " - in isolated mode, such properties are included, however";
+            "for both unified and isolated mode, optional default properties"
+            . " that plugins do not declare in options() are *not* included"
+            . " in updateSchema";
     }
 
     package OptionalCommonUnused::PluginBase {
@@ -719,10 +719,6 @@ package OptionalCommonUnused {
                     type => 'string',
                     optional => 1,
                 },
-                'common' => {
-                    type => 'string',
-                    optional => 1,
-                },
                 $SectionConfig::Helpers::UPDATE_SCHEMA_DEFAULT_PROPERTIES->%*,
             },
         };
-- 
2.47.3




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-15 12:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 12:19 [PATCH] section config: update schema: drop unusable global properties Dietmar Maurer

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