[pve-devel] [PATCH storage v7 2/9] storage migrate: avoid ssh when moving a volume locally
Filip Schauer
f.schauer at proxmox.com
Tue Mar 11 15:23:21 CET 2025
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.schauer at 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
More information about the pve-devel
mailing list