[pve-devel] [PATCH pve-network 2/4] generateconfig: use uplink$id if interface don't exist

Alexandre Derumier aderumier at odiso.com
Tue Jun 4 07:03:41 CEST 2019


don't die, generate config, and we'll check error
with ifquery as interface don't exist

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Network/Network/VlanPlugin.pm           | 3 +--
 PVE/Network/Network/VxlanMulticastPlugin.pm | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/PVE/Network/Network/VlanPlugin.pm b/PVE/Network/Network/VlanPlugin.pm
index affa274..f0119e4 100644
--- a/PVE/Network/Network/VlanPlugin.pm
+++ b/PVE/Network/Network/VlanPlugin.pm
@@ -68,7 +68,6 @@ sub generate_network_config {
     my $vlanallowed = $plugin_config->{'vlan-allowed'};
 
     die "missing vlan tag" if !$tag;
-    die "uplink $uplink is not defined" if !$uplinks->{$uplink};
 
     eval {
 	PVE::Network::Network::Plugin::parse_tag_number_or_range($vlanallowed, '4096', $tag) if $vlanallowed;
@@ -77,7 +76,7 @@ sub generate_network_config {
 	die "vlan $tag is not allowed in transport $zoneid";
     }
 
-    my $iface = $uplinks->{$uplink};
+    my $iface = $uplinks->{$uplink} ? $uplinks->{$uplink} : "uplink$uplink";
     $iface .= ".$tag";
 
     my $config = "\n";
diff --git a/PVE/Network/Network/VxlanMulticastPlugin.pm b/PVE/Network/Network/VxlanMulticastPlugin.pm
index 16dc593..7898f79 100644
--- a/PVE/Network/Network/VxlanMulticastPlugin.pm
+++ b/PVE/Network/Network/VxlanMulticastPlugin.pm
@@ -54,8 +54,7 @@ sub generate_network_config {
     my $vxlanallowed = $plugin_config->{'vxlan-allowed'};
 
     die "missing vxlan tag" if !$tag;
-    die "uplink $uplink is not defined" if !$uplinks->{$uplink};
-    my $iface = $uplinks->{$uplink};
+    my $iface = $uplinks->{$uplink} ? $uplinks->{$uplink} : "uplink$uplink";
 
     eval {
 	PVE::Network::Network::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag) if $vxlanallowed;
-- 
2.11.0




More information about the pve-devel mailing list