[pve-devel] [PATCH pve-network 8/8] api2 : sdn : add role and type to index

Alexandre Derumier aderumier at odiso.com
Mon Sep 30 11:03:39 CEST 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Network/SDN.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Network/SDN.pm b/PVE/API2/Network/SDN.pm
index 36d293d..b6dd23e 100644
--- a/PVE/API2/Network/SDN.pm
+++ b/PVE/API2/Network/SDN.pm
@@ -61,7 +61,10 @@ __PACKAGE__->register_method ({
 	type => 'array',
 	items => {
 	    type => "object",
-	    properties => { sdn => { type => 'string'} },
+	    properties => { sdn => { type => 'string'}, 
+			    type => { type => 'string'},
+			    role => { type => 'string'}
+			  },
 	},
 	links => [ { rel => 'child', href => "{sdn}" } ],
     },
@@ -82,6 +85,12 @@ __PACKAGE__->register_method ({
 
 	    my $scfg = &$api_sdn_config($cfg, $sdnid);
 	    next if $param->{type} && $param->{type} ne $scfg->{type};
+
+	    my $plugin_config = $cfg->{ids}->{$sdnid};
+	    my $plugin = PVE::Network::SDN::Plugin->lookup($plugin_config->{type});
+	    my $pd = $plugin->plugindata();
+	    my $role = $pd->{role};
+	    $scfg->{role} = $role;
 	    push @$res, $scfg;
 	}
 
-- 
2.20.1




More information about the pve-devel mailing list