[pve-devel] [PATCH 2/2] add veth_delete

Alexandre Derumier aderumier at odiso.com
Thu Jun 25 07:06:42 CEST 2015


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

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index a0f658b..23206c1 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -161,6 +161,14 @@ sub veth_create {
     &$activate_interface($vethpeer);
 }
 
+sub veth_delete {
+    my ($veth) = @_;
+
+    if (-d "/sys/class/net/$veth") {
+	run_command("/sbin/ip link delete dev $veth", outfunc => sub {}, errfunc => sub {});
+    }
+
+}
 
 my $create_firewall_bridge_linux = sub {
     my ($iface, $bridge) = @_;
@@ -215,9 +223,7 @@ my $cleanup_firewall_bridge = sub {
     }
 
     # delete old vethfw interface
-    if (-d "/sys/class/net/$vethfw") {
-	run_command("/sbin/ip link delete dev $vethfw", outfunc => sub {}, errfunc => sub {});
-    }
+    veth_delete($vethfw);
 
     # cleanup fwbr bridge
     if (-d "/sys/class/net/$fwbr") {
-- 
2.1.4




More information about the pve-devel mailing list