[pve-devel] [PATCH 2/2] Use array to run_command instead of a string.

Wolfgang Link w.link at proxmox.com
Wed Mar 16 14:24:36 CET 2016


---
 PVE/Storage.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index a248773..e7ff5a0 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -510,18 +510,19 @@ sub storage_migrate {
 
 	    my $zfspath = "$scfg->{pool}\/$volname";
 
-	    my $snap = "zfs snapshot $zfspath\@__migration__";
+	    my $snap = ['zfs', 'snapshot', "$zfspath\@__migration__"];
 
-	    my $send = "zfs send -Rpv $zfspath\@__migration__ \| ssh root\@$target_host zfs recv $zfspath";
+	    my $send = [['zfs', 'send', '-Rpv', "$zfspath\@__migration__"], ['ssh', "root\@$target_host",
+			'zfs', 'recv', $zfspath]];
 
-	    my $destroy_target = "ssh root\@$target_host zfs destroy $zfspath\@__migration__";
+	    my $destroy_target = ['ssh', "root\@$target_host", 'zfs', 'destroy', "$zfspath\@__migration__"];
  	    run_command($snap);
 	    eval{
 		run_command($send);
 	    };
 	    my $err;
 	    if ($err = $@){
-		run_command("zfs destroy $zfspath\@__migration__");
+		run_command(['zfs', 'destroy', "$zfspath\@__migration__"]);
 		die $err;
 	    }
 	    run_command($destroy_target);
-- 
2.1.4





More information about the pve-devel mailing list