--- trunk/vz-clone.pl 2007/10/05 01:09:12 30 +++ trunk/vz-clone.pl 2008/08/14 22:49:05 50 @@ -85,7 +85,7 @@ my ( $from, $to ) = @_; return if $action ne 'create'; warn "rsync $from -> $to\n"; - rsync('-raSHAD', "$from/", "$to/" ); + rsync('-raSHAD', '--delete', "$from/", "$to/" ); } if ( $vz_lv ) { @@ -169,11 +169,15 @@ my $note = "# modified by $0\n"; +my $ve_clone_ip; + sub fix_ip { my $ip = shift; $ip =~ s/['"]//g; - $ip =~ s/^\d+\./10./; +# $ip =~ s/^\d+\./10./; + $ip =~ s/^\d+\.\d+\./192.168./; warn "$CVEID new IP number: $ip\n"; + $ve_clone_ip = $ip; return $note . qq{IP_ADDRESS="$ip"}; } @@ -194,4 +198,4 @@ print $n $_; } -print "\nPlease review config file: $conf/$CVEID.conf\nAdd NAT for new VE with: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\nStart clone of $VEID with: vzctl start $CVEID\n" +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"