[pve-devel] applied: [PATCH pve-network 1/2] remove more variable declarations with post-ifs

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Jul 1 10:36:44 CEST 2020


usage of $mtu is always guarded by an if itself anyway, so all of these
are redundant post-ifs and can be removed.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/Network/SDN/Zones/QinQPlugin.pm | 4 ++--
 PVE/Network/SDN/Zones/VlanPlugin.pm | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm
index c0b2402..c8dd0ab 100644
--- a/PVE/Network/SDN/Zones/QinQPlugin.pm
+++ b/PVE/Network/SDN/Zones/QinQPlugin.pm
@@ -55,7 +55,7 @@ sub generate_sdn_config {
     die "can't find bridge $bridge" if !-d "/sys/class/net/$bridge";
 
     my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering");
-    my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif";
+    my $is_ovs = !-d "/sys/class/net/$bridge/brif";
 
     my @iface_config = ();
     my $vnet_bridge_ports = "";
@@ -177,7 +177,7 @@ sub status {
     }
 
     my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering");
-    my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif";
+    my $is_ovs = !-d "/sys/class/net/$bridge/brif";
 
     my $tag = $vnet->{tag};
     my $vnet_uplink = "ln_".$vnetid;
diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm b/PVE/Network/SDN/Zones/VlanPlugin.pm
index 8e99fc4..dedb32c 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -44,11 +44,11 @@ sub generate_sdn_config {
     die "can't find bridge $bridge" if !-d "/sys/class/net/$bridge";
 
     my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering");
-    my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif";
+    my $is_ovs = !-d "/sys/class/net/$bridge/brif";
 
     my $tag = $vnet->{tag};
     my $alias = $vnet->{alias};
-    my $mtu = $plugin_config->{mtu} if $plugin_config->{mtu};
+    my $mtu = $plugin_config->{mtu};
 
     my $vnet_uplink = "ln_".$vnetid;
     my $vnet_uplinkpeer = "pr_".$vnetid;
@@ -142,7 +142,7 @@ sub status {
     }
 
     my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering");
-    my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif";
+    my $is_ovs = !-d "/sys/class/net/$bridge/brif";
 
     my $tag = $vnet->{tag};
     my $vnet_uplink = "ln_".$vnetid;
-- 
2.20.1





More information about the pve-devel mailing list