[pve-devel] [PATCH 5/6] network : add tap_plug

Alexandre Derumier aderumier at odiso.com
Tue Mar 5 10:23:46 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 data/PVE/Network.pm |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm
index aca6b29..a7e55d7 100644
--- a/data/PVE/Network.pm
+++ b/data/PVE/Network.pm
@@ -64,6 +64,16 @@ sub tap_create {
 	die "interface activation failed\n" if $@;
 }
 
+sub tap_plug {
+    my ($iface, $bridge, $tag) = @_;
+
+    my $newbridge = activate_bridge_vlan($bridge, $tag);
+    copy_bridge_config($bridge, $newbridge) if $bridge ne $newbridge;
+
+    system ("/usr/sbin/brctl addif $newbridge $iface") == 0 ||
+	die "can't add interface to bridge\n";
+}
+
 sub copy_bridge_config {
     my ($br0, $br1) = @_;
 
-- 
1.7.10.4




More information about the pve-devel mailing list