--- trunk/vz-clone.pl 2009/02/27 20:49:06 66 +++ trunk/vz-clone.pl 2009/03/03 20:58:48 69 @@ -6,7 +6,7 @@ my $vz = '/vz'; my $conf = '/etc/vz/conf'; -my $snap_size = '1G'; +my $snap_size = '10G'; my ( $action, $VEID ) = @ARGV; @@ -52,10 +52,11 @@ umount( $clone ) if $clone; if ( $action eq 'destroy' && -e $snap ) { lvremove( '-f', $snap ); - exit; } - exit if $action eq 'umount'; + vzctl('destroy', $VEID) if $action eq 'destroy'; + + exit if $action =~ m{(umount|destroy)}; } @@ -198,5 +199,7 @@ print $n qq{DISK_QUOTA="no"\n} if $use_snapshot; # don't wait for quota rebuild on startup -print "\nPlease review config file: $conf/$CVEID.conf\nAdd NAT for new VE with: iptables -t nat -A POSTROUTING -s $ve_clone_ip -o eth0 -j MASQUERADE\nStart clone of $VEID with: vzctl start $CVEID\n" +my $iptables="iptables -t nat -A POSTROUTING -s $ve_clone_ip -o eth0 -j MASQUERADE"; +system( $iptables ); +print "\nConfig file: $conf/$CVEID.conf\nAdded NAT for new VE with: $iptables\nStart clone of $VEID with: vzctl start $CVEID\n"