[pve-devel] [PATCH v2 pve-network 05/15] rename transportzone option to zone

Alexandre Derumier aderumier at odiso.com
Tue Nov 26 10:00:20 CET 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Network/SDN/Zones/Content.pm |  4 ++--
 PVE/API2/Network/SDN/Zones/Status.pm  |  4 ++--
 PVE/Network/SDN/Controllers.pm        |  2 +-
 PVE/Network/SDN/Zones.pm              | 14 +++++++-------
 PVE/Network/SDN/Zones/EvpnPlugin.pm   |  2 +-
 PVE/Network/SDN/Zones/VlanPlugin.pm   |  4 ++--
 PVE/Network/SDN/Zones/VxlanPlugin.pm  |  4 ++--
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/PVE/API2/Network/SDN/Zones/Content.pm b/PVE/API2/Network/SDN/Zones/Content.pm
index 0ee6059..18dcb4c 100644
--- a/PVE/API2/Network/SDN/Zones/Content.pm
+++ b/PVE/API2/Network/SDN/Zones/Content.pm
@@ -20,7 +20,7 @@ __PACKAGE__->register_method ({
     name => 'index',
     path => '',
     method => 'GET',
-    description => "List transportzone content.",
+    description => "List zone content.",
 #    permissions => {
 #	check => ['perm', '/sdn/{sdn}', ['SDN.Audit'], any => 1],
 #    },
@@ -67,7 +67,7 @@ __PACKAGE__->register_method ({
         my ($transport_status, $vnet_status) = PVE::Network::SDN::status();
 
 	foreach my $id (keys %{$vnet_status}) {
-	    if ($vnet_status->{$id}->{transportzone} eq $transportid) {
+	    if ($vnet_status->{$id}->{zone} eq $transportid) {
 		my $item->{vnet} = $id;
 		$item->{status} = $vnet_status->{$id}->{'status'};
 		push @$res,$item;
diff --git a/PVE/API2/Network/SDN/Zones/Status.pm b/PVE/API2/Network/SDN/Zones/Status.pm
index 68af1ad..ee44f18 100644
--- a/PVE/API2/Network/SDN/Zones/Status.pm
+++ b/PVE/API2/Network/SDN/Zones/Status.pm
@@ -25,7 +25,7 @@ __PACKAGE__->register_method ({
     name => 'index',
     path => '',
     method => 'GET',
-    description => "Get status for all transportzones.",
+    description => "Get status for all zones.",
     permissions => {
 	description => "Only list entries where you have 'SDN.Audit'",
 	user => 'all',
@@ -45,7 +45,7 @@ __PACKAGE__->register_method ({
 	    properties => {
 		zone => get_standard_option('pve-sdn-zone-id'),
 		status => {
-		    description => "Status of transportzone",
+		    description => "Status of zone",
 		    type => 'string',
 		},
 	    },
diff --git a/PVE/Network/SDN/Controllers.pm b/PVE/Network/SDN/Controllers.pm
index 19ad15a..2ee349d 100644
--- a/PVE/Network/SDN/Controllers.pm
+++ b/PVE/Network/SDN/Controllers.pm
@@ -112,7 +112,7 @@ sub generate_controller_config {
 
     foreach my $id (keys %{$vnet_cfg->{ids}}) {
 	my $plugin_config = $vnet_cfg->{ids}->{$id};
-	my $transportid = $plugin_config->{transportzone};
+	my $transportid = $plugin_config->{zone};
 	next if !$transportid;
 	my $transport = $transport_cfg->{ids}->{$transportid};
 	next if !$transport;
diff --git a/PVE/Network/SDN/Zones.pm b/PVE/Network/SDN/Zones.pm
index 6638712..ba31db9 100644
--- a/PVE/Network/SDN/Zones.pm
+++ b/PVE/Network/SDN/Zones.pm
@@ -99,7 +99,7 @@ sub generate_etc_network_config {
     my $config = {};
     foreach my $id (keys %{$vnet_cfg->{ids}}) {
 	my $vnet = $vnet_cfg->{ids}->{$id};
-	my $zone = $vnet->{transportzone};
+	my $zone = $vnet->{zone};
 
 	if(!$zone) {
 	    warn "can't generate vnet $vnet : zone $zone don't exist";
@@ -200,24 +200,24 @@ sub status {
     my $transport_status = {};
 
     foreach my $id (keys %{$vnet_cfg->{ids}}) {
-	my $transportzone = $vnet_cfg->{ids}->{$id}->{transportzone};
-	$vnet_status->{$id}->{transportzone} = $transportzone;
-	$transport_status->{$transportzone}->{status} = 'available' if !defined($transport_status->{$transportzone}->{status});
+	my $zone = $vnet_cfg->{ids}->{$id}->{zone};
+	$vnet_status->{$id}->{zone} = $zone;
+	$transport_status->{$zone}->{status} = 'available' if !defined($transport_status->{$zone}->{status});
 
 	if($err_config) {
 	    $vnet_status->{$id}->{status} = $err_config;
-	    $transport_status->{$transportzone}->{status} = $err_config;
+	    $transport_status->{$zone}->{status} = $err_config;
 	} elsif ($status->{$id}->{status} && $status->{$id}->{status} eq 'pass') {
 	    $vnet_status->{$id}->{status} = 'available';
 	    my $bridgeport = $status->{$id}->{config}->{'bridge-ports'};
 
 	    if ($status->{$bridgeport}->{status} && $status->{$bridgeport}->{status} ne 'pass') {
 		$vnet_status->{$id}->{status} = 'error';
-		$transport_status->{$transportzone}->{status} = 'error';
+		$transport_status->{$zone}->{status} = 'error';
 	    }
 	} else {
 	    $vnet_status->{$id}->{status} = 'error';
-	    $transport_status->{$transportzone}->{status} = 'error';
+	    $transport_status->{$zone}->{status} = 'error';
 	}
     }
     return($transport_status, $vnet_status);
diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 179ecc1..d294bc3 100644
--- a/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -146,7 +146,7 @@ sub on_update_hook {
 	foreach my $id (keys %{$sdn_cfg->{ids}}) {
 	    my $sdn = $sdn_cfg->{ids}->{$id};
 	    if ($sdn->{type} eq 'vnet' && defined($sdn->{tag})) {
-		if(defined($sdn->{transportzone}) && $sdn->{transportzone} eq $transportid) {
+		if(defined($sdn->{zone}) && $sdn->{zone} eq $transportid) {
 		    my $tag = $sdn->{tag};
 		    eval {
 			PVE::Network::SDN::Zones::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag);
diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm b/PVE/Network/SDN/Zones/VlanPlugin.pm
index ab46d32..dd03838 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -80,7 +80,7 @@ sub on_delete_hook {
     foreach my $id (keys %{$sdn_cfg->{ids}}) {
 	my $sdn = $sdn_cfg->{ids}->{$id};
 	die "transport $transportid is used by vnet $id"
-	    if ($sdn->{type} eq 'vnet' && defined($sdn->{transportzone}) && $sdn->{transportzone} eq $transportid);
+	    if ($sdn->{type} eq 'vnet' && defined($sdn->{zone}) && $sdn->{zone} eq $transportid);
     }
 }
 
@@ -97,7 +97,7 @@ sub on_update_hook {
 	foreach my $id (keys %{$sdn_cfg->{ids}}) {
 	    my $sdn = $sdn_cfg->{ids}->{$id};
 	    if ($sdn->{type} eq 'vnet' && defined($sdn->{tag})) {
-		if(defined($sdn->{transportzone}) && $sdn->{transportzone} eq $transportid) {
+		if(defined($sdn->{zone}) && $sdn->{zone} eq $transportid) {
 		    my $tag = $sdn->{tag};
 		    eval {
 			PVE::Network::SDN::Zones::Plugin::parse_tag_number_or_range($vlanallowed, '4096', $tag);
diff --git a/PVE/Network/SDN/Zones/VxlanPlugin.pm b/PVE/Network/SDN/Zones/VxlanPlugin.pm
index cccf93a..bcabe1e 100644
--- a/PVE/Network/SDN/Zones/VxlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VxlanPlugin.pm
@@ -135,7 +135,7 @@ sub on_delete_hook {
     foreach my $id (keys %{$sdn_cfg->{ids}}) {
 	my $sdn = $sdn_cfg->{ids}->{$id};
 	die "transport $transportid is used by vnet $id"
-	    if ($sdn->{type} eq 'vnet' && defined($sdn->{transportzone}) && $sdn->{transportzone} eq $transportid);
+	    if ($sdn->{type} eq 'vnet' && defined($sdn->{zone}) && $sdn->{zone} eq $transportid);
     }
 }
 
@@ -152,7 +152,7 @@ sub on_update_hook {
 	foreach my $id (keys %{$sdn_cfg->{ids}}) {
 	    my $sdn = $sdn_cfg->{ids}->{$id};
 	    if ($sdn->{type} eq 'vnet' && defined($sdn->{tag})) {
-		if(defined($sdn->{transportzone}) && $sdn->{transportzone} eq $transportid) {
+		if(defined($sdn->{zone}) && $sdn->{zone} eq $transportid) {
 		    my $tag = $sdn->{tag};
 		    eval {
 			PVE::Network::SDN::Zones::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag);
-- 
2.20.1




More information about the pve-devel mailing list