aboutsummaryrefslogtreecommitdiff
path: root/src/lxc
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-07-05 17:07:48 +0100
committerDaniel P. Berrange <berrange@redhat.com>2012-07-05 17:40:52 +0100
commit60687546705bab38bd5245713601b717b9b16c9d (patch)
treebc69019e0b2be3d23c5771e1afe3672f80f45ed4 /src/lxc
parentFix one test regression on auth Ceph support (diff)
downloadlibvirt-60687546705bab38bd5245713601b717b9b16c9d.tar.gz
libvirt-60687546705bab38bd5245713601b717b9b16c9d.tar.bz2
libvirt-60687546705bab38bd5245713601b717b9b16c9d.zip
Only ummount /proc, /sys, /dev if the root source is '/'
Previous commits added code to unmount the existing /proc, /sys and /dev hierarchies on the root filesystem of the container. This should only have been done if the container's root filesystem was the same as the host's root. ie if the root source is '/'. As it is, this causes LXC containersr to fail to start if their root source is not '/' Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'src/lxc')
-rw-r--r--src/lxc/lxc_container.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 4f8703cff..145accb95 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1416,12 +1416,14 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
if (lxcContainerPivotRoot(root) < 0)
goto cleanup;
- /* Gets rid of any existing stuff under /proc, /sys & /tmp
+ /* If we have the root source being '/', then we need to
+ * get rid of any existing stuff under /proc, /sys & /tmp.
* We need new namespace aware versions of those. We must
* do /proc last otherwise we won't find /proc/mounts :-) */
- if (lxcContainerUnmountSubtree("/sys", false) < 0 ||
- lxcContainerUnmountSubtree("/dev", false) < 0 ||
- lxcContainerUnmountSubtree("/proc", false) < 0)
+ if (STREQ(root->src, "/") &&
+ (lxcContainerUnmountSubtree("/sys", false) < 0 ||
+ lxcContainerUnmountSubtree("/dev", false) < 0 ||
+ lxcContainerUnmountSubtree("/proc", false) < 0))
goto cleanup;
/* Mounts the core /proc, /sys, etc filesystems */