[pve-devel] [PATCH common v3 2/4] section config: allow base properties for {create, update}Schema()

Christoph Heiss c.heiss at proxmox.com
Thu Aug 10 14:37:06 CEST 2023


This works the same way as e.g. get_standard_option does it.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Changes v2 -> v3:
  * New patch; as suggested by Wolfgang

 src/PVE/SectionConfig.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm
index 97492db..2b75e6a 100644
--- a/src/PVE/SectionConfig.pm
+++ b/src/PVE/SectionConfig.pm
@@ -52,13 +52,13 @@ sub plugindata {
 }

 sub createSchema {
-    my ($class, $skip_type) = @_;
+    my ($class, $skip_type, $base) = @_;

     my $pdata = $class->private();
     my $propertyList = $pdata->{propertyList};
     my $plugins = $pdata->{plugins};

-    my $props = {};
+    my $props = $base || {};

     my $copy_property = sub {
 	my ($src) = @_;
@@ -107,13 +107,13 @@ sub createSchema {
 }

 sub updateSchema {
-    my ($class, $single_class) = @_;
+    my ($class, $single_class, $base) = @_;

     my $pdata = $class->private();
     my $propertyList = $pdata->{propertyList};
     my $plugins = $pdata->{plugins};

-    my $props = {};
+    my $props = $base || {};

     my $filter_type = $single_class ? $class->type() : undef;

--
2.41.0






More information about the pve-devel mailing list