storage migrate: avoid ssh when moving a volume locally
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@proxmox.com> Link: https://lore.proxmox.com/20250916123257.107491-3-f.schauer@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
e556534459
commit
829b0cd728
@ -940,10 +940,6 @@ sub storage_migrate {
|
|||||||
|
|
||||||
my $target_volid = "${target_storeid}:${target_volname}";
|
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})) {
|
if (!defined($opts->{snapshot})) {
|
||||||
$opts->{migration_snapshot} =
|
$opts->{migration_snapshot} =
|
||||||
storage_migrate_snapshot($cfg, $storeid, $opts->{with_snapshots});
|
storage_migrate_snapshot($cfg, $storeid, $opts->{with_snapshots});
|
||||||
@ -962,13 +958,19 @@ sub storage_migrate {
|
|||||||
my $format = $formats[0];
|
my $format = $formats[0];
|
||||||
|
|
||||||
my $import_fn = '-'; # let pvesm import read from stdin per default
|
my $import_fn = '-'; # let pvesm import read from stdin per default
|
||||||
if ($insecure) {
|
my $recv = [];
|
||||||
my $net = $target_sshinfo->{network} // $target_sshinfo->{ip};
|
|
||||||
$import_fn = "tcp://$net";
|
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 =
|
push @$recv, ($volume_import_prepare->($target_volid, $format, $import_fn, $opts)->@*);
|
||||||
[@$ssh, '--', $volume_import_prepare->($target_volid, $format, $import_fn, $opts)->@*];
|
|
||||||
|
|
||||||
my $new_volid;
|
my $new_volid;
|
||||||
my $pattern = volume_imported_message(undef, 1);
|
my $pattern = volume_imported_message(undef, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user