[pve-devel] [PATCH pve-container] skip lxc hooks on non-PVE containers

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Aug 31 16:21:41 CEST 2015


Our containers all only have a number as name. If any other
character appears in a container name, skip our hooks in
order to allow lxc to be used manually without interference
from PVE.
---
 src/lxc-pve-mount-hook    | 3 +++
 src/lxc-pve-poststop-hook | 3 +++
 src/lxc-pve-prestart-hook | 3 +++
 src/lxcnetaddbr           | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/src/lxc-pve-mount-hook b/src/lxc-pve-mount-hook
index eb80c9e..5ca33ee 100755
--- a/src/lxc-pve-mount-hook
+++ b/src/lxc-pve-mount-hook
@@ -2,6 +2,9 @@
 
 use strict;
 use warnings;
+
+exit 0 if $ENV{'LXC_NAME'} !~ /^\d+$/;
+
 use POSIX;
 use File::Path;
 
diff --git a/src/lxc-pve-poststop-hook b/src/lxc-pve-poststop-hook
index 407d659..17463e8 100755
--- a/src/lxc-pve-poststop-hook
+++ b/src/lxc-pve-poststop-hook
@@ -2,6 +2,9 @@
 
 use strict;
 use warnings;
+
+exit 0 if $ENV{'LXC_NAME'} !~ /^\d+$/;
+
 use POSIX;
 use File::Path;
 
diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
index 764cd2b..4de47c9 100755
--- a/src/lxc-pve-prestart-hook
+++ b/src/lxc-pve-prestart-hook
@@ -2,6 +2,9 @@
 
 use strict;
 use warnings;
+
+exit 0 if $ENV{'LXC_NAME'} !~ /^\d+$/;
+
 use POSIX;
 use File::Path;
 
diff --git a/src/lxcnetaddbr b/src/lxcnetaddbr
index bb8d726..aca6191 100755
--- a/src/lxcnetaddbr
+++ b/src/lxcnetaddbr
@@ -3,6 +3,8 @@
 use strict;
 use warnings;
 
+exit 0 if $ENV{LXC_NAME} !~ /^\d+$/;
+
 use PVE::LXC;
 use PVE::Tools qw(run_command);
 use PVE::Network;
-- 
2.1.4





More information about the pve-devel mailing list