* [PATCH] section config: update schema: drop unusable global properties
@ 2026-07-15 12:19 Dietmar Maurer
2026-07-15 23:11 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread
* applied: [PATCH] section config: update schema: drop unusable global properties
2026-07-15 12:19 [PATCH] section config: update schema: drop unusable global properties Dietmar Maurer
@ 2026-07-15 23:11 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-07-15 23:11 UTC (permalink / raw)
To: pve-devel, Dietmar Maurer
On Wed, 15 Jul 2026 14:19:28 +0200, Dietmar Maurer wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] section config: update schema: drop unusable global properties
commit: c3fa2c159206166fc3d05b1a1321b7a16ae9bc25
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-15 23:12 UTC | newest]
Thread overview: 2+ messages (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
2026-07-15 23:11 ` applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox