replace logmsg() with $self->log()

This commit is contained in:
Dietmar Maurer 2011-12-07 11:25:20 +01:00
parent a3c5221310
commit 46a84fd400

View File

@ -13,7 +13,7 @@ use PVE::QemuServer;
use base qw(PVE::AbstractMigrate); use base qw(PVE::AbstractMigrate);
sub fork_command_pipe { sub fork_command_pipe {
my ($cmd) = @_; my ($self, $cmd) = @_;
my $reader = IO::File->new(); my $reader = IO::File->new();
my $writer = IO::File->new(); my $writer = IO::File->new();
@ -28,7 +28,7 @@ sub fork_command_pipe {
# catch exec errors # catch exec errors
if ($orig_pid != $$) { if ($orig_pid != $$) {
logmsg('err', "can't fork command pipe\n"); $self->log('err', "can't fork command pipe\n");
POSIX::_exit(1); POSIX::_exit(1);
kill('KILL', $$); kill('KILL', $$);
} }
@ -39,7 +39,7 @@ sub fork_command_pipe {
} }
sub finish_command_pipe { sub finish_command_pipe {
my $cmdpipe = shift; my ($self, $cmdpipe) = @_;
my $writer = $cmdpipe->{writer}; my $writer = $cmdpipe->{writer};
my $reader = $cmdpipe->{reader}; my $reader = $cmdpipe->{reader};
@ -94,7 +94,7 @@ sub fork_tunnel {
my $cmd = [@{$self->{rem_ssh}}, '-L', "$lport:localhost:$rport", my $cmd = [@{$self->{rem_ssh}}, '-L', "$lport:localhost:$rport",
'qm', 'mtunnel' ]; 'qm', 'mtunnel' ];
my $tunnel = fork_command_pipe($cmd); my $tunnel = $self->fork_command_pipe($cmd);
my $reader = $tunnel->{reader}; my $reader = $tunnel->{reader};
@ -109,7 +109,7 @@ sub fork_tunnel {
my $err = $@; my $err = $@;
if ($err) { if ($err) {
finish_command_pipe($tunnel); $self->finish_command_pipe($tunnel);
die "can't open migration tunnel - $err"; die "can't open migration tunnel - $err";
} }
return $tunnel; return $tunnel;
@ -128,7 +128,7 @@ sub finish_tunnel {
}; };
my $err = $@; my $err = $@;
finish_command_pipe($tunnel); $self->finish_command_pipe($tunnel);
die $err if $err; die $err if $err;
} }
@ -312,7 +312,7 @@ sub phase2 {
my $conf = $self->{vmconf}; my $conf = $self->{vmconf};
logmsg('info', "starting VM $vmid on remote node '$self->{node}'"); $self->log('info', "starting VM $vmid on remote node '$self->{node}'");
my $rport; my $rport;