/[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 66 by dpavlin, Fri Feb 27 20:49:06 2009 UTC revision 69 by dpavlin, Tue Mar 3 20:58:48 2009 UTC
# Line 6  use Shell qw/rsync vzlist lvcreate mount Line 6  use Shell qw/rsync vzlist lvcreate mount
6  my $vz   = '/vz';  my $vz   = '/vz';
7  my $conf = '/etc/vz/conf';  my $conf = '/etc/vz/conf';
8    
9  my $snap_size = '1G';  my $snap_size = '10G';
10    
11  my ( $action, $VEID ) = @ARGV;  my ( $action, $VEID ) = @ARGV;
12    
# Line 52  if ( $action =~ m{(create|umount|destroy Line 52  if ( $action =~ m{(create|umount|destroy
52          umount( $clone ) if $clone;          umount( $clone ) if $clone;
53          if ( $action eq 'destroy' && -e $snap ) {          if ( $action eq 'destroy' && -e $snap ) {
54                  lvremove( '-f', $snap );                  lvremove( '-f', $snap );
                 exit;  
55          }          }
56    
57          exit if $action eq 'umount';          vzctl('destroy', $VEID) if $action eq 'destroy';
58    
59            exit if $action =~ m{(umount|destroy)};
60  }  }
61    
62    
# Line 198  while(<$o>) { Line 199  while(<$o>) {
199    
200  print $n qq{DISK_QUOTA="no"\n} if $use_snapshot; # don't wait for quota rebuild on startup  print $n qq{DISK_QUOTA="no"\n} if $use_snapshot; # don't wait for quota rebuild on startup
201    
202  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";
203    system( $iptables );
204    print "\nConfig file: $conf/$CVEID.conf\nAdded NAT for new VE with: $iptables\nStart clone of $VEID with: vzctl start $CVEID\n"
205    

Legend:
Removed from v.66  
changed lines
  Added in v.69

  ViewVC Help
Powered by ViewVC 1.1.26