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

Alexandre Derumier aderumier at odiso.com
Mon Jun 24 10:41:02 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 8af5f3f0..bfeaf784 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -24,6 +24,12 @@ use PVE::API2::Firewall::Cluster;
 use PVE::API2::ReplicationConfig;
 use PVE::API2::ACMEAccount;
 
+my $have_sdn;
+eval {
+    require PVE::API2::Network::SDN;
+    $have_sdn = 1;
+};
+
 use base qw(PVE::RESTHandler);
 
 __PACKAGE__->register_method ({
@@ -56,6 +62,13 @@ __PACKAGE__->register_method ({
     path => 'acme',
 });
 
+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 => {
@@ -105,6 +118,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