[pve-devel] [PATCH 2/2] PVE::AbstractMigrate: extent sub migrate to pass custom ssh parameter

Stefan Priebe s.priebe at profihost.ag
Tue Oct 30 15:44:32 CET 2012


From: Stefan Priebe <git at profihost.ag>


Signed-off-by: root <root at neuerserver.de-nserver.de.de-nserver.de>
---
 data/PVE/AbstractMigrate.pm |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/data/PVE/AbstractMigrate.pm b/data/PVE/AbstractMigrate.pm
index ccfcfb6..c60b6a5 100644
--- a/data/PVE/AbstractMigrate.pm
+++ b/data/PVE/AbstractMigrate.pm
@@ -104,42 +104,42 @@ my $eval_int = sub {
     };
 };
 
-# blowfish is a fast block cipher, much faster then 3des
-my @ssh_opts = ('-c', 'blowfish', '-o', 'BatchMode=yes');
-my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
-my @scp_cmd = ('/usr/bin/scp', @ssh_opts);
+my $ssh_cmd = '/usr/bin/ssh';
+my $scp_cmd = '/usr/bin/scp';
 my @rsync_opts = ('-aHAX', '--delete', '--numeric-ids');
 my @rsync_cmd = ('/usr/bin/rsync', @rsync_opts);
 
 sub migrate {
-    my ($class, $node, $nodeip, $vmid, $opts) = @_;
+    my ($class, $node, $nodeip, $vmid, $opts, $ssh_opts) = @_;
 
     $class = ref($class) || $class;
 
+    my @ssh_opts = PVE::Tools::build_ssh_opt( $ssh_opts );
+
     my $self = {
 	delayed_interrupt => 0,
 	opts => $opts,
+	ssh_opts => \@ssh_opts,
 	vmid => $vmid,
 	node => $node,
 	nodeip => $nodeip,
 	rsync_cmd => [ @rsync_cmd ],
-	rem_ssh => [ @ssh_cmd, "root\@$nodeip" ],
-	scp_cmd => [ @scp_cmd ],
+	rem_ssh => [ $ssh_cmd, @ssh_opts, "root\@$nodeip" ],
+	ssh_cmd => [ $ssh_cmd, @ssh_opts ],
+	scp_cmd => [ $scp_cmd, @ssh_opts ],
     };
 
     $self = bless $self, $class;
 
     my $starttime = time();
 
-    local $ENV{RSYNC_RSH} = join(' ', @ssh_cmd);
+    local $ENV{RSYNC_RSH} = join(' ', @{$self->{ssh_cmd}} );
 
     local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
 	$self->log('err', "received interrupt - delayed");
 	$self->{delayed_interrupt} = 1;
     };
 
-    local $ENV{RSYNC_RSH} = join(' ', @ssh_cmd);
-    
     # lock container during migration
     eval { $self->lock_vm($self->{vmid}, sub {
 
-- 
1.7.2.5




More information about the pve-devel mailing list