From e8a7e764afbee31609583ecce4300ba24cfff199 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 22 Jun 2017 12:24:38 +0200 Subject: [PATCH] storage_migrate: with_snapshots parameter Since the migration code already has to check snapshots and we still want to be able to migrate raw disks, we cannot always pass -with-snapshots 1. --- PVE/Storage.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index bbb71b9..4772c6c 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -525,7 +525,7 @@ sub abs_filesystem_path { } sub storage_migrate { - my ($cfg, $volid, $target_sshinfo, $target_storeid, $target_volname, $base_snapshot, $snapshot, $ratelimit_bps, $insecure) = @_; + my ($cfg, $volid, $target_sshinfo, $target_storeid, $target_volname, $base_snapshot, $snapshot, $ratelimit_bps, $insecure, $with_snapshots) = @_; my ($storeid, $volname) = parse_volume_id($volid); $target_volname = $volname if !$target_volname; @@ -557,7 +557,7 @@ sub storage_migrate { } } - my @formats = volume_transfer_formats($cfg, $volid, $volid, $snapshot, $base_snapshot, 1); + my @formats = volume_transfer_formats($cfg, $volid, $volid, $snapshot, $base_snapshot, $with_snapshots); die "cannot migrate from storage type '$scfg->{type}' to '$tcfg->{type}'\n" if !@formats; my $format = $formats[0]; @@ -569,8 +569,9 @@ sub storage_migrate { } } - my $send = ['pvesm', 'export', $volid, $format, '-', '-with-snapshots', '1']; - my $recv = [@$ssh, @insecurecmd, '--', 'pvesm', 'import', $volid, $format, '-', '-with-snapshots', '1']; + $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, @insecurecmd, '--', 'pvesm', 'import', $volid, $format, '-', '-with-snapshots', $with_snapshots]; if (defined($snapshot)) { push @$send, '-snapshot', $snapshot }