Fix start of containers with custom root filesystem

A prefix change to unmount the SELinux filesystem broke starting
of LXC containers with a custom root filesystem
(cherry picked from commit 1532bd498a)
This commit is contained in:
Daniel P. Berrange 2012-09-25 16:24:10 +01:00 committed by Cole Robinson
parent b53782f102
commit 6b2a4e2514

View File

@ -1191,6 +1191,8 @@ static int lxcContainerGetSubtree(const char *prefix,
char **mounts = NULL; char **mounts = NULL;
size_t nmounts = 0; size_t nmounts = 0;
VIR_DEBUG("prefix=%s", prefix);
*mountsret = NULL; *mountsret = NULL;
*nmountsret = 0; *nmountsret = 0;
@ -1528,7 +1530,8 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
/* Some versions of Linux kernel don't let you overmount /* Some versions of Linux kernel don't let you overmount
* the selinux filesystem, so make sure we kill it first * the selinux filesystem, so make sure we kill it first
*/ */
if (lxcContainerUnmountSubtree(SELINUX_MOUNT, false) < 0) if (STREQ(root->src, "/") &&
lxcContainerUnmountSubtree(SELINUX_MOUNT, false) < 0)
goto cleanup; goto cleanup;
#endif #endif