]> git.proxmox.com Git - vzctl.git/commitdiff
fwbr bridge cleanup on container umount
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 23 May 2014 13:11:38 +0000 (15:11 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 3 Jun 2014 04:41:10 +0000 (06:41 +0200)
call proxmox.umount script, on container umount.
Works if the container is shutdown from vzctl or inside guest with shutdown command

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
debian/patches/bridge-cleanup.patch [new file with mode: 0644]
debian/patches/series
debian/proxmox.umount [new file with mode: 0755]
debian/rules

diff --git a/debian/patches/bridge-cleanup.patch b/debian/patches/bridge-cleanup.patch
new file mode 100644 (file)
index 0000000..8ea71a9
--- /dev/null
@@ -0,0 +1,27 @@
+From 07e05c92bb26ceb8b88dfbc4e5b9f3a8406d7268 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier@odiso.com>
+Date: Fri, 23 May 2014 14:53:04 +0200
+Subject: [PATCH] execute proxmox.umount script on filesystem umount
+
+
+Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
+---
+ src/lib/fs.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/lib/fs.c b/src/lib/fs.c
+index c02cbea..342cf7c 100644
+--- a/src/lib/fs.c
++++ b/src/lib/fs.c
+@@ -216,6 +216,8 @@ int vps_umount(vps_handler *h, envid_t veid, const fs_param *fs,
+                       }
+                       snprintf(buf, sizeof(buf), "%svps.%s", VPS_CONF_DIR,
+                               UMOUNT_PREFIX);
++                      snprintf(buf, sizeof(buf), "%s/proxmox.%s", SCRIPTDIR,
++                              UMOUNT_PREFIX);
+               }
+       }
+       if (!(ret = fsumount(veid, fs)))
+-- 
+1.7.10.4
+
index 9dab92cef4f7112fc53f7e6697432c702342a44e..9a30459ecef9f9f54bd5b84a6f0480a570bf9a07 100644 (file)
@@ -10,3 +10,4 @@ always-create-dev-console.patch
 #keep-bridge-MTU.patch
 fix-vzifup-post-error.patch
 pass-bridge-value-as-argument-to-VZNETCFG.patch
+bridge-cleanup.patch
diff --git a/debian/proxmox.umount b/debian/proxmox.umount
new file mode 100755 (executable)
index 0000000..d6457df
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use PVE::OpenVZ;
+use PVE::Tools qw(run_command);
+use PVE::Network;
+use PVE::ProcFSTools;
+use Data::Dumper;
+
+my $vmid = $ENV{VEID};
+die "missing vmid parameter" if !$vmid;
+
+my $conf = PVE::OpenVZ::load_config($vmid);
+
+my $ifaces = {};
+if (defined ($conf->{netif}) && $conf->{netif}->{value}) {
+       $ifaces = PVE::OpenVZ::parse_netif($conf->{netif}->{value}, $vmid);
+}
+
+foreach my $ifname (sort keys %$ifaces) {
+    PVE::Network::tap_unplug($ifaces->{$ifname}->{host_ifname});
+}
+
+exit 0;
+
+
index c9805fd7f2b9c013e8683d180dd4d527dbae4897..e29db5602e2ffe025dc8664c4e8e77d5f15d310c 100644 (file)
@@ -98,6 +98,9 @@ install: build
        # install perl vznetaddbr version
        install -m 644 $(CURDIR)/debian/vznetaddbr $(CURDIR)/debian/vzctl/usr/sbin/vznetaddbr
 
+       # install proxmox bridge cleanup script
+       install -m 644 $(CURDIR)/debian/proxmox.umount $(CURDIR)/debian/vzctl/usr/lib/vzctl/scripts/proxmox.umount
+
 
 
 # Build architecture-independent files here.