use PVE::ProcFSTools;
use PVE::Tools;
use PVE::Cluster;
+use PVE::DataCenterConfig;
use PVE::Storage;
use PVE::GuestHelpers;
use PVE::ReplicationConfig;
use PVE::ReplicationState;
+use PVE::SSHInfo;
# regression tests should overwrite this
sub remote_prepare_local_job {
my ($ssh_info, $jobid, $vmid, $volumes, $storeid_list, $last_sync, $parent_snapname, $force, $logfunc) = @_;
- my $ssh_cmd = PVE::Cluster::ssh_info_to_command($ssh_info);
+ my $ssh_cmd = PVE::SSHInfo::ssh_info_to_command($ssh_info);
my $cmd = [@$ssh_cmd, '--', 'pvesr', 'prepare-local-job', $jobid];
push @$cmd, '--scan', join(',', @$storeid_list) if scalar(@$storeid_list);
push @$cmd, @$volumes if scalar(@$volumes);
sub remote_finalize_local_job {
my ($ssh_info, $jobid, $vmid, $volumes, $last_sync, $logfunc) = @_;
- my $ssh_cmd = PVE::Cluster::ssh_info_to_command($ssh_info);
+ my $ssh_cmd = PVE::SSHInfo::ssh_info_to_command($ssh_info);
my $cmd = [@$ssh_cmd, '--', 'pvesr', 'finalize-local-job', $jobid,
@$volumes, '--last_sync', $last_sync];
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid);
- my $ratelimit_bps = int(1000000*$rate) if $rate;
+ my $ratelimit_bps = $rate ? int(1000000 * $rate) : undef;
+
PVE::Storage::storage_migrate($storecfg, $volid, $ssh_info, $storeid, $volname,
$base_snapshot, $sync_snapname, $ratelimit_bps, $insecure, 1, $logfunc);
}
my %hash = map { $_ => 1 } @store_list;
- my $ssh_info = PVE::Cluster::get_ssh_info($jobcfg->{target});
+ my $ssh_info = PVE::SSHInfo::get_ssh_info($jobcfg->{target});
remote_prepare_local_job($ssh_info, $jobid, $vmid, [], [ keys %hash ], 1, undef, 1, $logfunc);
}
return undef;
}
- my $ssh_info = PVE::Cluster::get_ssh_info($jobcfg->{target}, $migration_network);
+ my $ssh_info = PVE::SSHInfo::get_ssh_info($jobcfg->{target}, $migration_network);
my $parent_snapname = $conf->{parent};
my $rate = $jobcfg->{rate};
my $insecure = $migration_type eq 'insecure';
+ $logfunc->("using $migration_type transmission, rate limit: "
+ . ($rate ? "$rate MByte/s" : "none"));
+
foreach my $volid (@$sorted_volids) {
my $base_snapname;
my $volumes;
- # we normaly write errors into the state file,
+ # we normally write errors into the state file,
# but we also catch unexpected errors and log them to syslog
# (for examply when there are problems writing the state file)