34 |
} |
} |
35 |
|
|
36 |
|
|
37 |
if ( $action =~ m/(create|umount|destroy)/ ) { |
if ( $action =~ m{(create|umount|destroy)} ) { |
38 |
my $clone; |
my $clone; |
39 |
|
my $snap; |
40 |
open(my $m, '-|', 'mount') || die "can't open mount: $!"; |
open(my $m, '-|', 'mount') || die "can't open mount: $!"; |
41 |
while(<$m>) { |
while(<$m>) { |
42 |
my @v = split(/\s+/,$_); |
my @v = split(/\s+/,$_); |
43 |
if ( $v[2] =~ m{/(private|root)/$CVEID$} && $v[5] =~ m/bind/ ) { |
if ( $v[2] =~ m{/(private|root)/($VEID|$CVEID)$} && $v[5] =~ m{bind} ) { |
44 |
umount( $v[2] ); |
umount( $v[2] ); |
45 |
} elsif ( $v[2] =~ m{vz-clone-$CVEID$} ) { |
} elsif ( $v[2] =~ m{vz-clone-$CVEID$} ) { |
46 |
$clone = $v[2]; |
$clone = $v[2]; |
47 |
|
} elsif ( $v[2] =~ m{-snap} ) { |
48 |
|
$snap = $v[0]; |
49 |
|
umount( $snap ); |
50 |
} |
} |
51 |
} |
} |
52 |
umount( $clone ) if $clone; |
umount( $clone ) if $clone; |
53 |
lvremove( '-f', $clone ); |
if ( $action eq 'destroy' && -e $snap ) { |
54 |
|
lvremove( '-f', $snap ); |
55 |
|
exit; |
56 |
|
} |
57 |
|
|
58 |
exit if $action eq 'umount'; |
exit if $action eq 'umount'; |
59 |
} |
} |
199 |
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 |
200 |
|
|
201 |
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" |
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" |
202 |
|
|