[pve-devel] [PATCH] Commits for feature request documented here, http://pve.proxmox.com/pipermail/pve-devel/2014-September/012730.html This introduces functionality to use a single multi-tagged interface within a guest (ie. for routers/firewalls)

Ben Lessani ben at sonassi.com
Mon Sep 15 19:49:09 CEST 2014


Signed-off-by: Ben Lessani <ben at sonassi.com>
---
 PVE/API2/Qemu.pm  |    4 ++--
 PVE/QemuServer.pm |    5 ++++-
 pve-bridge        |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 985a9f8..ea05f1a 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -847,9 +847,9 @@ my $vmconfig_update_net = sub {
 		    PVE::Network::tap_rate_limit($iface, $newnet->{rate});
 		}
 
-		if(($newnet->{bridge} ne $oldnet->{bridge}) || ($newnet->{tag} ne $oldnet->{tag}) || ($newnet->{firewall} ne $oldnet->{firewall})){
+        if(($newnet->{bridge} ne $oldnet->{bridge}) || ($newnet->{tag} ne $oldnet->{tag}) || ($newnet->{firewall} ne $oldnet->{firewall}) || ($newnet->{trunks} ne $oldnet->{trunks})){
 		    PVE::Network::tap_unplug($iface);
-		    PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall});
+            PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{tag}, $newnet->{trunks});
 		}
 
 	    }else{
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2058131..4b1274b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -485,7 +485,7 @@ my $nic_model_list_txt = join(' ', sort @$nic_model_list);
 my $netdesc = {
     optional => 1,
     type => 'string', format => 'pve-qm-net',
-    typetext => "MODEL=XX:XX:XX:XX:XX:XX [,bridge=<dev>][,queues=<nbqueues>][,rate=<mbps>][,tag=<vlanid>][,firewall=0|1]",
+    typetext => "MODEL=XX:XX:XX:XX:XX:XX [,bridge=<dev>][,queues=<nbqueues>][,rate=<mbps>][,tag=<vlanid>][,firewall=0|1][,trunks=<vlanids>]",
     description => <<EODESCR,
 Specify network devices.
 
@@ -1324,6 +1324,8 @@ sub parse_net {
             $res->{tag} = $1;
         } elsif ($kvp =~ m/^firewall=(\d+)$/) {
 	    $res->{firewall} = $1;
+        } elsif ($kvp =~ m/^trunks=([0-9;]+)$/) {
+        $res->{trunks} = $1;        
 	} else {
 	    return undef;
 	}
@@ -1344,6 +1346,7 @@ sub print_net {
     $res .= ",rate=$net->{rate}" if $net->{rate};
     $res .= ",tag=$net->{tag}" if $net->{tag};
     $res .= ",firewall=$net->{firewall}" if $net->{firewall};
+    $res .= ",trunks=$net->{trunks}" if $net->{trunks};
 
     return $res;
 }
diff --git a/pve-bridge b/pve-bridge
index d6c5eb8..48f63f5 100755
--- a/pve-bridge
+++ b/pve-bridge
@@ -30,6 +30,6 @@ PVE::Network::tap_create($iface, $net->{bridge});
 
 PVE::Network::tap_rate_limit($iface, $net->{rate}) if $net->{rate};
 
-PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall});
+PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks});
 
 exit 0;
-- 
1.7.10.4




More information about the pve-devel mailing list