vzctl create: disallow VE_PRIVATE be a mount point

As it is pointed out in bug #3166, when VE_PRIVATE is a mount point,
container creation leads to a bunch of weird errors:

 # vzctl create $CTID --private '/data/$VEID'
 Creating container private area (debian-7.0-x86_64-minimal)
 Can't rename /data/10001.tmp to /data/10001: Device or resource busy
 Destroying container private area: /data/10001
 Warning: directory /data/10001 is not on the same filesystem as /data/10001/vztmp - doing slow/sync removal
 /bin/rm: cannot remove `/data/10001': Device or resource busy
 Creation of container private area failed

Previous attempt to fix this was to introduce logic for a special case
when VE_PRIVATE is a mount point (see commits d6664f6a0e8d2e2,
2b1db5b8b638886, 320bc278ac7d2e3, and 33e7f02ce9a4dd4). Apparently,
we can fix create this way, but more patches are needed to also fix
vzctl destroy operation.

An easier solution is just to check if VE_PRIVATE is a mount point
and do not allow to create a container in such case, suggesting to
use a subdirectory instead. This is what this commit does.

https://bugzilla.openvz.org/3166

Reported-by: Pavel Odintsov <pavel.odintsov@gmail.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed