Sanitizing $with_snapshots is done on extraction to save a line.

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---
 PVE/API2/Storage/Content.pm |  2 +-
 PVE/Storage.pm              | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm
index 63fa4fc..f2e3e57 100644
--- a/PVE/API2/Storage/Content.pm
+++ b/PVE/API2/Storage/Content.pm
@@ -418,7 +418,7 @@ __PACKAGE__->register_method ({
            # you need to get this working (fails currently, because 
storage_migrate() uses
            # ssh to connect to local host (which is not needed
            my $sshinfo = PVE::SSHInfo::get_ssh_info($target_node);
-           PVE::Storage::storage_migrate($cfg, $src_volid, $sshinfo, 
$target_sid, $target_volname);
+           PVE::Storage::storage_migrate($cfg, $src_volid, $sshinfo, 
$target_sid, {'target_volname' => $target_volname});
 
            print "DEBUG: end worker $upid\n";
 
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 7af1fc3..dc415e2 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -563,10 +563,17 @@ sub abs_filesystem_path {
 }
 
 sub storage_migrate {
-    my ($cfg, $volid, $target_sshinfo, $target_storeid, $target_volname, 
$base_snapshot, $snapshot, $ratelimit_bps, $insecure, $with_snapshots, 
$logfunc) = @_;
+    my ($cfg, $volid, $target_sshinfo, $target_storeid, $opts, $logfunc) = @_;
+
+    my $base_snapshot = $opts->{base_snapshot};
+    my $snapshot = $opts->{snapshot};
+    my $ratelimit_bps = $opts->{ratelimit_bps};
+    my $insecure = $opts->{insecure};
+    my $with_snapshots = $opts->{with_snapshots} ? 1 : 0;
+    my $allow_rename = $opts->{allow_rename} ? 1 : 0;
 
     my ($storeid, $volname) = parse_volume_id($volid);
-    $target_volname = $volname if !$target_volname;
+    my $target_volname = $opts->{target_volname} || $volname;
 
     my $scfg = storage_config($cfg, $storeid);
 
@@ -609,7 +616,6 @@ sub storage_migrate {
        $import_fn = "tcp://$net";
     }
 
-    $with_snapshots = $with_snapshots ? 1 : 0; # sanitize for passing as cli 
parameter
     my $send = ['pvesm', 'export', $volid, $format, '-', '-with-snapshots', 
$with_snapshots];
     my $recv = [@$ssh, '--', 'pvesm', 'import', $target_volid, $format, 
$import_fn, '-with-snapshots', $with_snapshots];
     if (defined($snapshot)) {
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to