[pve-devel] [PATCH pve-network 2/2] rename PVE::Network::Network to PVE::Network::SDN

Alexandre Derumier aderumier at odiso.com
Fri Jun 7 06:52:13 CEST 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Network/Makefile                          |  2 +-
 PVE/API2/Network/{Network.pm => SDN.pm}            | 62 +++++++++++-----------
 PVE/Network/Makefile                               |  4 +-
 PVE/Network/{Network.pm => SDN.pm}                 | 22 ++++----
 PVE/Network/{Network => SDN}/Makefile              |  2 +-
 PVE/Network/{Network => SDN}/Plugin.pm             |  4 +-
 PVE/Network/{Network => SDN}/VlanPlugin.pm         | 10 ++--
 PVE/Network/{Network => SDN}/VnetPlugin.pm         |  6 +--
 .../{Network => SDN}/VxlanMulticastPlugin.pm       | 10 ++--
 test/generateconfig.pl                             | 18 +++----
 test/statuscheck.pl                                | 12 ++---
 11 files changed, 76 insertions(+), 76 deletions(-)
 rename PVE/API2/Network/{Network.pm => SDN.pm} (77%)
 rename PVE/Network/{Network.pm => SDN.pm} (75%)
 rename PVE/Network/{Network => SDN}/Makefile (88%)
 rename PVE/Network/{Network => SDN}/Plugin.pm (95%)
 rename PVE/Network/{Network => SDN}/VlanPlugin.pm (92%)
 rename PVE/Network/{Network => SDN}/VnetPlugin.pm (93%)
 rename PVE/Network/{Network => SDN}/VxlanMulticastPlugin.pm (91%)

diff --git a/PVE/API2/Network/Makefile b/PVE/API2/Network/Makefile
index a7f3c31..4b2fda3 100644
--- a/PVE/API2/Network/Makefile
+++ b/PVE/API2/Network/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Network.pm
+SOURCES=SDN.pm
 
 
 PERL5DIR=${DESTDIR}/usr/share/perl5
diff --git a/PVE/API2/Network/Network.pm b/PVE/API2/Network/SDN.pm
similarity index 77%
rename from PVE/API2/Network/Network.pm
rename to PVE/API2/Network/SDN.pm
index 14d9903..2efc620 100644
--- a/PVE/API2/Network/Network.pm
+++ b/PVE/API2/Network/SDN.pm
@@ -1,4 +1,4 @@
-package PVE::API2::Network::Network;
+package PVE::API2::Network::SDN;
 
 use strict;
 use warnings;
@@ -6,11 +6,11 @@ use warnings;
 use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param);
 use PVE::Cluster qw(cfs_read_file cfs_write_file);
-use PVE::Network::Network;
-use PVE::Network::Network::Plugin;
-use PVE::Network::Network::VlanPlugin;
-use PVE::Network::Network::VxlanMulticastPlugin;
-use PVE::Network::Network::VnetPlugin;
+use PVE::Network::SDN;
+use PVE::Network::SDN::Plugin;
+use PVE::Network::SDN::VlanPlugin;
+use PVE::Network::SDN::VxlanMulticastPlugin;
+use PVE::Network::SDN::VnetPlugin;
 use Storable qw(dclone);
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::RPCEnvironment;
@@ -19,12 +19,12 @@ use PVE::RESTHandler;
 
 use base qw(PVE::RESTHandler);
 
-my $network_type_enum = PVE::Network::Network::Plugin->lookup_types();
+my $network_type_enum = PVE::Network::SDN::Plugin->lookup_types();
 
 my $api_network_config = sub {
     my ($cfg, $networkid) = @_;
 
-    my $scfg = dclone(PVE::Network::Network::network_config($cfg, $networkid));
+    my $scfg = dclone(PVE::Network::SDN::network_config($cfg, $networkid));
     $scfg->{network} = $networkid;
     $scfg->{digest} = $cfg->{digest};
 
@@ -66,9 +66,9 @@ __PACKAGE__->register_method ({
 	my $authuser = $rpcenv->get_user();
 
 
-	my $cfg = PVE::Network::Network::config();
+	my $cfg = PVE::Network::SDN::config();
 
-	my @sids = PVE::Network::Network::networks_ids($cfg);
+	my @sids = PVE::Network::SDN::networks_ids($cfg);
 	my $res = [];
 	foreach my $networkid (@sids) {
 #	    my $privs = [ 'Network.Audit', 'Network.Allocate' ];
@@ -101,7 +101,7 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
-	my $cfg = PVE::Network::Network::config();
+	my $cfg = PVE::Network::SDN::config();
 
 	return &$api_network_config($cfg, $param->{network});
     }});
@@ -115,7 +115,7 @@ __PACKAGE__->register_method ({
 #    permissions => { 
 #	check => ['perm', '/cluster/network', ['Network.Allocate']],
 #    },
-    parameters => PVE::Network::Network::Plugin->createSchema(),
+    parameters => PVE::Network::SDN::Plugin->createSchema(),
     returns => { type => 'null' },
     code => sub {
 	my ($param) = @_;
@@ -123,16 +123,16 @@ __PACKAGE__->register_method ({
 	my $type = extract_param($param, 'type');
 	my $networkid = extract_param($param, 'network');
 
-	my $plugin = PVE::Network::Network::Plugin->lookup($type);
+	my $plugin = PVE::Network::SDN::Plugin->lookup($type);
 	my $opts = $plugin->check_config($networkid, $param, 1, 1);
 
-        PVE::Network::Network::lock_network_config(
+        PVE::Network::SDN::lock_network_config(
 	    sub {
 
-		my $cfg = PVE::Network::Network::config();
+		my $cfg = PVE::Network::SDN::config();
 
 		my $scfg = undef;
-		if ($scfg = PVE::Network::Network::network_config($cfg, $networkid, 1)) {
+		if ($scfg = PVE::Network::SDN::network_config($cfg, $networkid, 1)) {
 		    die "network object ID '$networkid' already defined\n";
 		}
 
@@ -143,11 +143,11 @@ __PACKAGE__->register_method ({
 		    my $transportid = $scfg->{transportzone};
 		    die "missing transportzone" if !$transportid;
 		    my $transport_cfg = $cfg->{ids}->{$transportid};
-		    my $transport_plugin = PVE::Network::Network::Plugin->lookup($transport_cfg->{type});
+		    my $transport_plugin = PVE::Network::SDN::Plugin->lookup($transport_cfg->{type});
 		    $transport_plugin->on_update_hook($transportid, $cfg);
 		}
 
-		PVE::Network::Network::write_config($cfg);
+		PVE::Network::SDN::write_config($cfg);
 	    
 	    }, "create network object failed");
 
@@ -203,7 +203,7 @@ __PACKAGE__->register_method ({
 #    permissions => { 
 #	check => ['perm', '/cluster/network', ['Network.Allocate']],
 #    },
-    parameters => PVE::Network::Network::Plugin->updateSchema(),
+    parameters => PVE::Network::SDN::Plugin->updateSchema(),
     returns => { type => 'null' },
     code => sub {
 	my ($param) = @_;
@@ -211,16 +211,16 @@ __PACKAGE__->register_method ({
 	my $networkid = extract_param($param, 'network');
 	my $digest = extract_param($param, 'digest');
 
-        PVE::Network::Network::lock_network_config(
+        PVE::Network::SDN::lock_network_config(
 	 sub {
 
-	    my $cfg = PVE::Network::Network::config();
+	    my $cfg = PVE::Network::SDN::config();
 
 	    PVE::SectionConfig::assert_if_modified($cfg, $digest);
 
-	    my $scfg = PVE::Network::Network::network_config($cfg, $networkid);
+	    my $scfg = PVE::Network::SDN::network_config($cfg, $networkid);
 
-	    my $plugin = PVE::Network::Network::Plugin->lookup($scfg->{type});
+	    my $plugin = PVE::Network::SDN::Plugin->lookup($scfg->{type});
 	    my $opts = $plugin->check_config($networkid, $param, 0, 1);
 
 	    foreach my $k (%$opts) {
@@ -233,10 +233,10 @@ __PACKAGE__->register_method ({
                 my $transportid = $scfg->{transportzone};
                 die "missing transportzone" if !$transportid;
                 my $transport_cfg = $cfg->{ids}->{$transportid};
-                my $transport_plugin = PVE::Network::Network::Plugin->lookup($transport_cfg->{type});
+                my $transport_plugin = PVE::Network::SDN::Plugin->lookup($transport_cfg->{type});
                 $transport_plugin->on_update_hook($transportid, $cfg);
             }
-	    PVE::Network::Network::write_config($cfg);
+	    PVE::Network::SDN::write_config($cfg);
 
 	    }, "update network object failed");
 
@@ -256,7 +256,7 @@ __PACKAGE__->register_method ({
     	additionalProperties => 0,
 	properties => { 
 	    network => get_standard_option('pve-network-id', {
-                completion => \&PVE::Network::Network::complete_network,
+                completion => \&PVE::Network::SDN::complete_network,
             }),
 	},
     },
@@ -266,18 +266,18 @@ __PACKAGE__->register_method ({
 
 	my $networkid = extract_param($param, 'network');
 
-        PVE::Network::Network::lock_network_config(
+        PVE::Network::SDN::lock_network_config(
 	    sub {
 
-		my $cfg = PVE::Network::Network::config();
+		my $cfg = PVE::Network::SDN::config();
 
-		my $scfg = PVE::Network::Network::network_config($cfg, $networkid);
+		my $scfg = PVE::Network::SDN::network_config($cfg, $networkid);
 
-		my $plugin = PVE::Network::Network::Plugin->lookup($scfg->{type});
+		my $plugin = PVE::Network::SDN::Plugin->lookup($scfg->{type});
 		$plugin->on_delete_hook($networkid, $cfg);
 
 		delete $cfg->{ids}->{$networkid};
-		PVE::Network::Network::write_config($cfg);
+		PVE::Network::SDN::write_config($cfg);
 
 	    }, "delete network object failed");
 
diff --git a/PVE/Network/Makefile b/PVE/Network/Makefile
index 6f17f37..277e19c 100644
--- a/PVE/Network/Makefile
+++ b/PVE/Network/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Network.pm
+SOURCES=SDN.pm
 
 
 PERL5DIR=${DESTDIR}/usr/share/perl5
@@ -6,4 +6,4 @@ PERL5DIR=${DESTDIR}/usr/share/perl5
 .PHONY: install
 install:
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/PVE/Network/$$i; done
-	make -C Network install
+	make -C SDN install
diff --git a/PVE/Network/Network.pm b/PVE/Network/SDN.pm
similarity index 75%
rename from PVE/Network/Network.pm
rename to PVE/Network/SDN.pm
index a95b2c2..efac541 100644
--- a/PVE/Network/Network.pm
+++ b/PVE/Network/SDN.pm
@@ -1,4 +1,4 @@
-package PVE::Network::Network;
+package PVE::Network::SDN;
 
 use strict;
 use warnings;
@@ -8,15 +8,15 @@ use JSON;
 
 use PVE::Tools qw(extract_param dir_glob_regex run_command);
 use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
-use PVE::Network::Network::Plugin;
-use PVE::Network::Network::VnetPlugin;
-use PVE::Network::Network::VlanPlugin;
-use PVE::Network::Network::VxlanMulticastPlugin;
+use PVE::Network::SDN::Plugin;
+use PVE::Network::SDN::VnetPlugin;
+use PVE::Network::SDN::VlanPlugin;
+use PVE::Network::SDN::VxlanMulticastPlugin;
 
-PVE::Network::Network::VnetPlugin->register();
-PVE::Network::Network::VlanPlugin->register();
-PVE::Network::Network::VxlanMulticastPlugin->register();
-PVE::Network::Network::Plugin->init();
+PVE::Network::SDN::VnetPlugin->register();
+PVE::Network::SDN::VlanPlugin->register();
+PVE::Network::SDN::VxlanMulticastPlugin->register();
+PVE::Network::SDN::Plugin->init();
 
 
 sub network_config {
@@ -60,9 +60,9 @@ sub networks_ids {
 sub complete_network {
     my ($cmdname, $pname, $cvalue) = @_;
 
-    my $cfg = PVE::Network::Network::config();
+    my $cfg = PVE::Network::SDN::config();
 
-    return  $cmdname eq 'add' ? [] : [ PVE::Network::Network::networks_ids($cfg) ];
+    return  $cmdname eq 'add' ? [] : [ PVE::Network::SDN::networks_ids($cfg) ];
 }
 
 sub status {
diff --git a/PVE/Network/Network/Makefile b/PVE/Network/SDN/Makefile
similarity index 88%
rename from PVE/Network/Network/Makefile
rename to PVE/Network/SDN/Makefile
index 085f93d..194a708 100644
--- a/PVE/Network/Network/Makefile
+++ b/PVE/Network/SDN/Makefile
@@ -5,5 +5,5 @@ PERL5DIR=${DESTDIR}/usr/share/perl5
 
 .PHONY: install
 install:
-	for i in ${SOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/PVE/Network/Network/$$i; done
+	for i in ${SOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/PVE/Network/SDN/$$i; done
 
diff --git a/PVE/Network/Network/Plugin.pm b/PVE/Network/SDN/Plugin.pm
similarity index 95%
rename from PVE/Network/Network/Plugin.pm
rename to PVE/Network/SDN/Plugin.pm
index 6c34711..3f6d808 100644
--- a/PVE/Network/Network/Plugin.pm
+++ b/PVE/Network/SDN/Plugin.pm
@@ -1,4 +1,4 @@
-package PVE::Network::Network::Plugin;
+package PVE::Network::SDN::Plugin;
 
 use strict;
 use warnings;
@@ -27,7 +27,7 @@ my $defaultData = {
 	    type => 'string',
 	},
         network => get_standard_option('pve-network-id',
-            { completion => \&PVE::Network::Network::complete_network }),
+            { completion => \&PVE::Network::SDN::complete_network }),
     },
 };
 
diff --git a/PVE/Network/Network/VlanPlugin.pm b/PVE/Network/SDN/VlanPlugin.pm
similarity index 92%
rename from PVE/Network/Network/VlanPlugin.pm
rename to PVE/Network/SDN/VlanPlugin.pm
index f27e217..364a19a 100644
--- a/PVE/Network/Network/VlanPlugin.pm
+++ b/PVE/Network/SDN/VlanPlugin.pm
@@ -1,10 +1,10 @@
-package PVE::Network::Network::VlanPlugin;
+package PVE::Network::SDN::VlanPlugin;
 
 use strict;
 use warnings;
-use PVE::Network::Network::Plugin;
+use PVE::Network::SDN::Plugin;
 
-use base('PVE::Network::Network::Plugin');
+use base('PVE::Network::SDN::Plugin');
 
 sub type {
     return 'vlan';
@@ -14,7 +14,7 @@ PVE::JSONSchema::register_format('pve-network-vlanrange', \&pve_verify_network_v
 sub pve_verify_network_vlanrange {
    my ($vlanstr) = @_;
 
-   PVE::Network::Network::Plugin::parse_tag_number_or_range($vlanstr, '4096');
+   PVE::Network::SDN::Plugin::parse_tag_number_or_range($vlanstr, '4096');
 
    return $vlanstr;
 }
@@ -117,7 +117,7 @@ sub on_update_hook {
 		if(defined($network->{transportzone}) && $network->{transportzone} eq $transportid) {
 		    my $tag = $network->{tag};
 		    eval {
-			PVE::Network::Network::Plugin::parse_tag_number_or_range($vlanallowed, '4096', $tag);
+			PVE::Network::SDN::Plugin::parse_tag_number_or_range($vlanallowed, '4096', $tag);
 		    };
 		    if($@) {
 			die "vlan $tag is not allowed in transport $transportid";
diff --git a/PVE/Network/Network/VnetPlugin.pm b/PVE/Network/SDN/VnetPlugin.pm
similarity index 93%
rename from PVE/Network/Network/VnetPlugin.pm
rename to PVE/Network/SDN/VnetPlugin.pm
index eeb7e82..ecab6a3 100644
--- a/PVE/Network/Network/VnetPlugin.pm
+++ b/PVE/Network/SDN/VnetPlugin.pm
@@ -1,10 +1,10 @@
-package PVE::Network::Network::VnetPlugin;
+package PVE::Network::SDN::VnetPlugin;
 
 use strict;
 use warnings;
-use PVE::Network::Network::Plugin;
+use PVE::Network::SDN::Plugin;
 
-use base('PVE::Network::Network::Plugin');
+use base('PVE::Network::SDN::Plugin');
 
 use PVE::Cluster;
 
diff --git a/PVE/Network/Network/VxlanMulticastPlugin.pm b/PVE/Network/SDN/VxlanMulticastPlugin.pm
similarity index 91%
rename from PVE/Network/Network/VxlanMulticastPlugin.pm
rename to PVE/Network/SDN/VxlanMulticastPlugin.pm
index c6dea92..750da4f 100644
--- a/PVE/Network/Network/VxlanMulticastPlugin.pm
+++ b/PVE/Network/SDN/VxlanMulticastPlugin.pm
@@ -1,16 +1,16 @@
-package PVE::Network::Network::VxlanMulticastPlugin;
+package PVE::Network::SDN::VxlanMulticastPlugin;
 
 use strict;
 use warnings;
-use PVE::Network::Network::Plugin;
+use PVE::Network::SDN::Plugin;
 
-use base('PVE::Network::Network::Plugin');
+use base('PVE::Network::SDN::Plugin');
 
 PVE::JSONSchema::register_format('pve-network-vxlanrange', \&pve_verify_network_vxlanrange);
 sub pve_verify_network_vxlanrange {
    my ($vxlanstr) = @_;
 
-   PVE::Network::Network::Plugin::parse_tag_number_or_range($vxlanstr, '16777216');
+   PVE::Network::SDN::Plugin::parse_tag_number_or_range($vxlanstr, '16777216');
 
    return $vxlanstr;
 }
@@ -105,7 +105,7 @@ sub on_update_hook {
 		if(defined($network->{transportzone}) && $network->{transportzone} eq $transportid) {
 		    my $tag = $network->{tag};
 		    eval {
-			PVE::Network::Network::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag);
+			PVE::Network::SDN::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag);
 		    };
 		    if($@) {
 			die "vnet $id - vlan $tag is not allowed in transport $transportid";
diff --git a/test/generateconfig.pl b/test/generateconfig.pl
index 4921d97..1477261 100644
--- a/test/generateconfig.pl
+++ b/test/generateconfig.pl
@@ -3,15 +3,15 @@ use warnings;
 use File::Copy;
 use PVE::Cluster qw(cfs_read_file);
 
-use PVE::Network::Network::Plugin;
-use PVE::Network::Network::VnetPlugin;
-use PVE::Network::Network::VlanPlugin;
-use PVE::Network::Network::VxlanMulticastPlugin;
+use PVE::Network::SDN::Plugin;
+use PVE::Network::SDN::VnetPlugin;
+use PVE::Network::SDN::VlanPlugin;
+use PVE::Network::SDN::VxlanMulticastPlugin;
 
-PVE::Network::Network::VnetPlugin->register();
-PVE::Network::Network::VlanPlugin->register();
-PVE::Network::Network::VxlanMulticastPlugin->register();
-PVE::Network::Network::Plugin->init();
+PVE::Network::SDN::VnetPlugin->register();
+PVE::Network::SDN::VlanPlugin->register();
+PVE::Network::SDN::VxlanMulticastPlugin->register();
+PVE::Network::SDN::Plugin->init();
 
 
 my $rawconfig = generate_network_config();
@@ -61,7 +61,7 @@ sub generate_network_config {
 	     die "zone $zone don't exist" if !$zone;
 	     my $plugin_config = $transport_cfg->{ids}->{$zone};
 	     die "zone $zone don't exist" if !defined($plugin_config);
-             my $plugin = PVE::Network::Network::Plugin->lookup($plugin_config->{type});
+             my $plugin = PVE::Network::SDN::Plugin->lookup($plugin_config->{type});
              $rawconfig .= $plugin->generate_network_config($plugin_config, $zone, $id, $vnet, $uplinks);
         }
 
diff --git a/test/statuscheck.pl b/test/statuscheck.pl
index 0a8a712..619a957 100644
--- a/test/statuscheck.pl
+++ b/test/statuscheck.pl
@@ -3,15 +3,15 @@ use warnings;
 use File::Copy;
 use PVE::Cluster qw(cfs_read_file);
 
-use PVE::Network::Network;
+use PVE::Network::SDN;
 use Data::Dumper;
-use PVE::Network::Network::Plugin;
-use PVE::Network::Network::VnetPlugin;
-use PVE::Network::Network::VlanPlugin;
-use PVE::Network::Network::VxlanMulticastPlugin;
+use PVE::Network::SDN::Plugin;
+use PVE::Network::SDN::VnetPlugin;
+use PVE::Network::SDN::VlanPlugin;
+use PVE::Network::SDN::VxlanMulticastPlugin;
 
 
-my $status = PVE::Network::Network::status();
+my $status = PVE::Network::SDN::status();
 
 my $network_cfg = PVE::Cluster::cfs_read_file('networks.cfg');
 my $vnet_cfg = undef;
-- 
2.11.0




More information about the pve-devel mailing list