[pve-devel] [PATCH 1/2] PVE::Storage: use build_ssh_opt instead of static blowfish encryption (make it look a bit more like migrate in AbstractMigrate)

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


From: Stefan Priebe <git at profihost.ag>


Signed-off-by: root <root at neuerserver.de-nserver.de.de-nserver.de>
---
 PVE/Storage.pm |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 271b3f9..a5f4d83 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -9,7 +9,7 @@ use File::Path;
 use Cwd 'abs_path';
 use Socket;
 
-use PVE::Tools qw(run_command file_read_firstline);
+use PVE::Tools qw(run_command file_read_firstline build_ssh_opt);
 use PVE::Cluster qw(cfs_read_file cfs_lock_file);
 use PVE::Exception qw(raise_param_exc);
 use PVE::JSONSchema;
@@ -320,6 +320,8 @@ sub path {
     return wantarray ? ($path, $owner, $vtype) : $path;
 }
 
+my $ssh_cmd = '/usr/bin/ssh';
+
 sub storage_migrate {
     my ($cfg, $volid, $target_host, $target_storeid, $target_volname) = @_;
 
@@ -337,11 +339,12 @@ sub storage_migrate {
 
     my $errstr = "unable to migrate '$volid' to '${target_volid}' on host '$target_host'";
 
-    # blowfish is a fast block cipher, much faster then 3des
-    my $sshoptions = "-c blowfish -o 'BatchMode=yes'";
-    my $ssh = "/usr/bin/ssh $sshoptions";
+    my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg');
+    my $ssh_opts = {};
+    $ssh_opts->{cipher} = $datacenterconf->{cipher} if ( $datacenterconf->{cipher} );
+    my @ssh_opts = PVE::Tools::build_ssh_opt( $ssh_opts );
 
-    local $ENV{RSYNC_RSH} = $ssh;
+    local $ENV{RSYNC_RSH} = join(' ', ( $ssh_cmd, @ssh_opts ) );
 
     # only implemented for file system based storage
     if ($scfg->{path}) {
-- 
1.7.2.5




More information about the pve-devel mailing list