[pve-devel] [PATCH pve-manager 1/5] api2 : cluster: add sdn api endpoint

Alexandre Derumier aderumier at odiso.com
Wed Aug 21 05:22:36 CEST 2019


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

diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index 47a89d21..ba9bef27 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -27,6 +27,12 @@ use PVE::API2::Firewall::Cluster;
 use PVE::API2::HAConfig;
 use PVE::API2::ReplicationConfig;
 
+my $have_sdn;
+eval {
+    require PVE::API2::Network::SDN;
+    $have_sdn = 1;
+};
+
 use base qw(PVE::RESTHandler);
 
 __PACKAGE__->register_method ({
@@ -64,6 +70,13 @@ __PACKAGE__->register_method ({
     path => 'ceph',
 });
 
+if ($have_sdn) {
+    __PACKAGE__->register_method ({
+       subclass => "PVE::API2::Network::SDN",
+       path => 'sdn',
+    });
+}
+
 my $dc_schema = PVE::Cluster::get_datacenter_schema();
 my $dc_properties = { 
     delete => {
@@ -113,6 +126,10 @@ __PACKAGE__->register_method ({
 	    { name => 'ceph' },
 	    ];
 
+	if ($have_sdn) {
+	    push(@{$result}, { name => 'sdn' });
+	}
+
 	return $result;
     }});
 
-- 
2.20.1




More information about the pve-devel mailing list