]> git.proxmox.com Git - pve-guest-common.git/blobdiff - PVE/AbstractMigrate.pm
bump version to 3.0-10
[pve-guest-common.git] / PVE / AbstractMigrate.pm
index 1efd502462d43c2ebe1f2fa69bc1112017cb4dd3..af2be389901b1d5c643c0f0283b43be477347212 100644 (file)
@@ -6,7 +6,9 @@ use POSIX qw(strftime);
 use JSON;
 use PVE::Tools;
 use PVE::Cluster;
+use PVE::DataCenterConfig;
 use PVE::ReplicationState;
+use PVE::SSHInfo;
 
 my $msg2text = sub {
     my ($level, $msg) = @_;
@@ -89,13 +91,13 @@ my $eval_int = sub {
     my ($self, $func, @param) = @_;
 
     eval {
-       local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub {
-           $self->{delayed_interrupt} = 0;
-           die "interrupted by signal\n";
-       };
-       local $SIG{PIPE} = sub {
-           $self->{delayed_interrupt} = 0;
-           die "interrupted by signal\n";
+       local $SIG{INT} =
+           local $SIG{TERM} =
+           local $SIG{QUIT} =
+           local $SIG{HUP} =
+           local $SIG{PIPE} = sub {
+               $self->{delayed_interrupt} = 0;
+               die "interrupted by signal\n";
        };
 
        my $di = $self->{delayed_interrupt};
@@ -107,9 +109,6 @@ my $eval_int = sub {
     };
 };
 
-my @ssh_opts = ('-o', 'BatchMode=yes');
-my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
-
 # FIXME: nodeip is now unused
 sub migrate {
     my ($class, $node, $nodeip, $vmid, $opts) = @_;
@@ -122,7 +121,7 @@ sub migrate {
     if (!defined($migration_network)) {
        $migration_network = $dc_conf->{migration}->{network};
     }
-    my $ssh_info = PVE::Cluster::get_ssh_info($node, $migration_network);
+    my $ssh_info = PVE::SSHInfo::get_ssh_info($node, $migration_network);
     $nodeip = $ssh_info->{ip};
 
     my $migration_type = 'secure';
@@ -140,16 +139,20 @@ sub migrate {
        node => $node,
        ssh_info => $ssh_info,
        nodeip => $nodeip,
-       rem_ssh => PVE::Cluster::ssh_info_to_command($ssh_info)
+       rem_ssh => PVE::SSHInfo::ssh_info_to_command($ssh_info)
     };
 
     $self = bless $self, $class;
 
     my $starttime = time();
 
-    local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
-       $self->log('err', "received interrupt - delayed");
-       $self->{delayed_interrupt} = 1;
+    local $SIG{INT} =
+       local $SIG{TERM} =
+       local $SIG{QUIT} =
+       local $SIG{HUP} =
+       local $SIG{PIPE} = sub {
+           $self->log('err', "received interrupt - delayed");
+           $self->{delayed_interrupt} = 1;
     };
 
     # lock container during migration