[pve-devel] [PATCH V2 pve-manager] API2: Network: display vnets in any_bridge

Alexandre Derumier aderumier at odiso.com
Thu Mar 26 03:07:42 CET 2020


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

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 4c691879..32ab8ebd 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -18,6 +18,7 @@ use base qw(PVE::RESTHandler);
 
 my $have_sdn;
 eval {
+    require PVE::Network::SDN;
     require PVE::Network::SDN::Zones;
     require PVE::Network::SDN::Controllers;
     $have_sdn = 1;
@@ -246,6 +247,13 @@ __PACKAGE__->register_method({
 		    ($type eq 'bridge' || $type eq 'OVSBridge'));
 		delete $ifaces->{$k} if !$match;
 	    }
+
+	    if ($have_sdn && $param->{type} eq 'any_bridge') {
+		my $vnets = PVE::Network::SDN::get_local_vnets();
+		map {
+		    $ifaces->{$_} = $vnets->{$_};
+		} keys %$vnets;
+	    }
 	}
 
 	return PVE::RESTHandler::hash_to_array($ifaces, 'iface');
-- 
2.20.1




More information about the pve-devel mailing list