/[vz-tools]/trunk/vz-clone.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/vz-clone.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 30 by dpavlin, Fri Oct 5 01:09:12 2007 UTC revision 50 by dpavlin, Thu Aug 14 22:49:05 2008 UTC
# Line 85  sub copy_files { Line 85  sub copy_files {
85          my ( $from, $to ) = @_;          my ( $from, $to ) = @_;
86          return if $action ne 'create';          return if $action ne 'create';
87          warn "rsync $from -> $to\n";          warn "rsync $from -> $to\n";
88          rsync('-raSHAD', "$from/", "$to/" );          rsync('-raSHAD', '--delete', "$from/", "$to/" );
89  }  }
90    
91  if ( $vz_lv ) {  if ( $vz_lv ) {
# Line 169  exit if $action eq 'mount'; Line 169  exit if $action eq 'mount';
169    
170  my $note = "# modified by $0\n";  my $note = "# modified by $0\n";
171    
172    my $ve_clone_ip;
173    
174  sub fix_ip {  sub fix_ip {
175          my $ip = shift;          my $ip = shift;
176          $ip =~ s/['"]//g;          $ip =~ s/['"]//g;
177          $ip =~ s/^\d+\./10./;  #       $ip =~ s/^\d+\./10./;
178            $ip =~ s/^\d+\.\d+\./192.168./;
179          warn "$CVEID new IP number: $ip\n";          warn "$CVEID new IP number: $ip\n";
180            $ve_clone_ip = $ip;
181          return $note . qq{IP_ADDRESS="$ip"};          return $note . qq{IP_ADDRESS="$ip"};
182  }  }
183    
# Line 194  while(<$o>) { Line 198  while(<$o>) {
198          print $n $_;          print $n $_;
199  }  }
200    
201  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"

Legend:
Removed from v.30  
changed lines
  Added in v.50

  ViewVC Help
Powered by ViewVC 1.1.26