[pve-devel] [PATCH] ovs_bridge_add_port : made it public

Alexandre Derumier aderumier at odiso.com
Tue May 3 17:05:39 CEST 2016


It's used to add vhost-user configuration is ovs from qemu-server,
as we can't use script/downscript like for tap interface

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

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index be26132..7e01921 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -194,8 +194,8 @@ my $bridge_add_interface = sub {
    }
 };
 
-my $ovs_bridge_add_port = sub {
-    my ($bridge, $iface, $tag, $internal, $trunks) = @_;
+sub ovs_bridge_add_port {
+    my ($bridge, $iface, $tag, $type, $trunks) = @_;
 
     $trunks =~ s/;/,/g if $trunks;
 
@@ -204,7 +204,7 @@ my $ovs_bridge_add_port = sub {
     $cmd .= " trunks=". join(',', $trunks) if $trunks;
     $cmd .= " vlan_mode=native-untagged" if $tag && $trunks;
 
-    $cmd .= " -- set Interface $iface type=internal" if $internal;
+    $cmd .= " -- set Interface $iface type=$type" if $type;
     system($cmd) == 0 ||
 	die "can't add ovs port '$iface'\n";
 };
@@ -288,7 +288,7 @@ my $create_firewall_bridge_ovs = sub {
 
     &$bridge_add_interface($fwbr, $iface);
 
-    &$ovs_bridge_add_port($bridge, $ovsintport, $tag, 1, $trunks);
+    ovs_bridge_add_port($bridge, $ovsintport, $tag, 'internal', $trunks);
     &$activate_interface($ovsintport);
 
     # set the same mtu for ovs int port
@@ -350,7 +350,7 @@ sub tap_plug {
 	if ($firewall) {
 	    &$create_firewall_bridge_ovs($iface, $bridge, $tag, $trunks);
 	} else {
-	    &$ovs_bridge_add_port($bridge, $iface, $tag, undef, $trunks);
+	    ovs_bridge_add_port($bridge, $iface, $tag, undef, $trunks);
 	}
     }
 
-- 
2.1.4




More information about the pve-devel mailing list