Avoid the overhead of SSH when $target_sshinfo is undefined. Instead move a volume between storages on the same node.
Signed-off-by: Filip Schauer <f.scha...@proxmox.com> --- src/PVE/Storage.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index d885882..88e4e6d 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -815,10 +815,6 @@ sub storage_migrate { my $target_volid = "${target_storeid}:${target_volname}"; - my $target_ip = $target_sshinfo->{ip}; - - my $ssh = PVE::SSHInfo::ssh_info_to_command($target_sshinfo); - if (!defined($opts->{snapshot})) { $opts->{migration_snapshot} = storage_migrate_snapshot($cfg, $storeid, $opts->{with_snapshots}); $opts->{snapshot} = '__migration__' if $opts->{migration_snapshot}; @@ -829,12 +825,19 @@ sub storage_migrate { my $format = $formats[0]; my $import_fn = '-'; # let pvesm import read from stdin per default - if ($insecure) { - my $net = $target_sshinfo->{network} // $target_sshinfo->{ip}; - $import_fn = "tcp://$net"; + my $recv = []; + + if (defined($target_sshinfo)) { + if ($insecure) { + my $net = $target_sshinfo->{network} // $target_sshinfo->{ip}; + $import_fn = "tcp://$net"; + } + + my $ssh = PVE::SSHInfo::ssh_info_to_command($target_sshinfo); + push @$recv, (@$ssh, '--'); } - my $recv = [ @$ssh, '--', $volume_import_prepare->($target_volid, $format, $import_fn, $opts)->@* ]; + push @$recv, ($volume_import_prepare->($target_volid, $format, $import_fn, $opts)->@*); my $new_volid; my $pattern = volume_imported_message(undef, 1); -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel