From: Alexandre Derumier Date: Fri, 23 May 2014 13:11:38 +0000 (+0200) Subject: fwbr bridge cleanup on container umount X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=00d89cf8c3dd48088e5e889f20781531bc6937f3;p=vzctl.git fwbr bridge cleanup on container umount 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 --- diff --git a/debian/patches/bridge-cleanup.patch b/debian/patches/bridge-cleanup.patch new file mode 100644 index 0000000..8ea71a9 --- /dev/null +++ b/debian/patches/bridge-cleanup.patch @@ -0,0 +1,27 @@ +From 07e05c92bb26ceb8b88dfbc4e5b9f3a8406d7268 Mon Sep 17 00:00:00 2001 +From: Alexandre Derumier +Date: Fri, 23 May 2014 14:53:04 +0200 +Subject: [PATCH] execute proxmox.umount script on filesystem umount + + +Signed-off-by: Alexandre Derumier +--- + 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 + diff --git a/debian/patches/series b/debian/patches/series index 9dab92c..9a30459 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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 index 0000000..d6457df --- /dev/null +++ b/debian/proxmox.umount @@ -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; + + diff --git a/debian/rules b/debian/rules index c9805fd..e29db56 100644 --- a/debian/rules +++ b/debian/rules @@ -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.