openvz clone fails (root mount missing ??)

629 views
Skip to first unread message

flba

unread,
Nov 20, 2012, 10:36:52 AM11/20/12
to ovz-we...@googlegroups.com
Hi,

I have just finished a fresh install of owp (2.1) on Scientific Linux (6.3) and basically all is working fine. 
However the cloning of a container (e.g. 100 -> 101) fails with these error messages:

Internal error: Command 'vzctl set 101 --userpasswd root:XXX' execution failed with code 6
Output: Starting container...
stat(/vz/root/101): No such file or directory
stat(/vz/root/101): No such file or directory
realpath(/vz/root/101) failed: No such file or directory
Can't umount /vz/root/101: No such file or directory
stat(/vz/root/101): No such file or directory
unable to change dir to /vz/root/101: No such file or directory
Not enough resources to start environment
Container start failed (try to check kernel messages, e.g. "dmesg | tail")
Error: Unable to apply new quota values: quota not running
stat(/vz/root/101): No such file or directory
stat(/vz/root/101): No such file or directory
realpath(/vz/root/101) failed: No such file or directory
Can't umount /vz/root/101: No such file or directory

The reason for this seems to be that the mountpoint /vz/root/101 is missing.
I checked the hwdaemon.log and there is the command sequence to clone the
container, but no commands for creating the mount point /vz/root/101

[...]
2012-11-20 16:21:17] DEBUG Exec command: cp -a /vz/private/100 /vz/private/101 ; code: 0; output:
[2012-11-20 16:21:17] DEBUG accept: 10.89.250.15:57412
[2012-11-20 16:21:17] DEBUG HwDaemonApiHandler is invoked.
[2012-11-20 16:21:17] DEBUG Execute method: hwDaemon.exec
[2012-11-20 16:21:17] DEBUG Exec command: vzctl chkpnt 100 --resume; code: 0; output:
Resuming...
[2012-11-20 16:21:17] DEBUG accept: 10.89.250.15:57413
[2012-11-20 16:21:17] DEBUG HwDaemonApiHandler is invoked.
[2012-11-20 16:21:17] DEBUG Execute method: hwDaemon.exec
[2012-11-20 16:21:17] DEBUG Exec command: vzctl set 101 --userpasswd root:XXX; code: 1536; output:
Starting container...
stat(/vz/root/101): No such file or directory

[...]

adding an experimental 

'hardware_server.rpc_client.exec("mkdir /vz/root/#{shellescape(identity.to_s)}")' 

to  ./app/models/virtual_server.rb  solves the problem.

However since this is such an obvious error and I did not find any complaints and error reports on this, I doubt the missing 
mkdir is the problem, but a mere workaround for a more fundamental setup problem on my side :-D

In both cases comments would be appreciated :-D

regards







barrief

unread,
Nov 21, 2012, 12:39:10 AM11/21/12
to ovz-we...@googlegroups.com
Hi,
I use a script to be sure to clone in right conditions.
here is the clone.sh script  :

#! /bin/bash

if  [ $# != 3 ]; then
   echo "Usage $0 old_id new_id new_ip"
   exit 0
fi

OLDVE=$1
NEWVE=$2
IP=$3

echo "Stopping ve$OLDVE..."
vzctl stop $OLDVE
echo "Copying configuration..."
mkdir /vz/root/$NEWVE
cp /etc/vz/conf/$OLDVE.conf /etc/vz/conf/$NEWVE.conf
mkdir /vz/private/$NEWVE
echo "Cloneing ve$OLDVE..."
pushd /vz/private/$OLDVE; tar c --numeric-owner * | tar x --numeric-owner -C /vz/private/$NEWVE; popd
echo "Updateing ve$NEWVE configuration..."
cat /etc/vz/conf/$OLDVE.conf | grep -v "IP_ADDRESS" | grep -v "HOSTNAME" > /etc/vz/conf/clone.conf
echo "IP_ADDRESS=\"$IP\"" >> /etc/vz/conf/clone.conf
echo "HOSTNAME=\"ve$NEWVE.haite.ch\"" >> /etc/vz/conf/clone.conf
mv /etc/vz/conf/clone.conf /etc/vz/conf/$NEWVE.conf
echo "Starting clone..."
vzctl start $NEWVE
echo "Starting origin ve..."
vzctl start $OLDVE
echo "Done."

That's it ! the command to run will be :  clone.sh  <old-id> <new-id>  <new-ip>

let us know how it's working !

rgds

flba

unread,
Nov 21, 2012, 3:13:45 AM11/21/12
to ovz-we...@googlegroups.com
Hi and thanks for the answer.

Basically your script mirrors the steps I am using when cloning a container on the command line. Works fine. However the problem is not the cloning in general, but that the web panel fails to clone a container using the clone method. 

When I clone a container on the CLI I have to create the destinations root mount point (using mkdir) before starting the container resp setting the container's parameter. Looking at you script I find a similar mkdir /vz/root/$NEWVE to create that mount point.

Checking the code of the web panel I can not find such a  'mkdir', which would explain why cloning a container using the web panel fails.

I guess I'll submit a bug report.

Thanks for your help
kind regards

Alexei Yuzhakov

unread,
Feb 5, 2013, 5:48:55 AM2/5/13
to ovz-we...@googlegroups.com

sozo...@gmail.com

unread,
Apr 30, 2013, 8:38:54 AM4/30/13
to ovz-we...@googlegroups.com
Hi Alexi, flba,

please could i have your helping? Because i program actualy a program on the cloning! i want to have the correctly clone.sh et batch program if possible.
I'm newbie
Sincerely

Sozo

Gatis Visnevskis

unread,
May 10, 2013, 6:41:42 AM5/10/13
to ovz-we...@googlegroups.com
Hi,

i'm looking for a way to make cloning work.

i have /vz/private/1010 folder linked under /vm2/1010
clone fails, as this cp -a command creates copy of symlink.

# cp -a /vz/private/1010 /vz/private/9999
# ls -la
lrwxrwxrwx  1 root root    9 May 10 13:32 9999 -> /vm2/1010
lrwxrwxrwx  1 root root    9 May 10 13:32 1010 -> /vm2/1010

Gasha
Reply all
Reply to author
Forward
0 new messages