Introduce and use check_ploop_size()

As pointed out in bug #2250, sometimes CTs come with
DISKSPACE="unlimited", which is effectlively LONG_MAX.

We are definitely not able to create a ploop device this big,
so let's add a check that it's less than some max value.

We have tried to figure out what the value is, and theoretically
it seems that it is 2 TB minus 2GB for block map and 1M for some
auxiliary data such as header. This value is also less than LONG_MAX
(on 32-bit arch) so we effectively check for 'less than unlimited' as well.

Check is done for vzctl create, vzctl convert, and vzctl set.
An appropriate message is printed in case diskspace is set too high,
and VZ_DISKSPACE_NOT_SET error code (63) is returned by vzctl.

Error code 63 description in vzctl(8) man page modified accordingly.

http://bugzilla.openvz.org/2250

Reported-by: Paparaciz <helpaz@gmail.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
4 files changed