From: Dietmar Maurer <dietmar@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH] section config: update schema: drop unusable global properties
Date: Wed, 15 Jul 2026 14:19:28 +0200 [thread overview]
Message-ID: <20260715121928.3434829-1-dietmar@proxmox.com> (raw)
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
reply other threads:[~2026-07-15 12:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260715121928.3434829-1-dietmar@proxmox.com \
--to=dietmar@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox