Collect optional parameters for storage_migrate into $opts
Sanitizing $with_snapshots is done on extraction to save a line. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
b9364dc683
commit
dc3655a1a5
@ -418,7 +418,7 @@ __PACKAGE__->register_method ({
|
|||||||
# you need to get this working (fails currently, because storage_migrate() uses
|
# you need to get this working (fails currently, because storage_migrate() uses
|
||||||
# ssh to connect to local host (which is not needed
|
# ssh to connect to local host (which is not needed
|
||||||
my $sshinfo = PVE::SSHInfo::get_ssh_info($target_node);
|
my $sshinfo = PVE::SSHInfo::get_ssh_info($target_node);
|
||||||
PVE::Storage::storage_migrate($cfg, $src_volid, $sshinfo, $target_sid, $target_volname);
|
PVE::Storage::storage_migrate($cfg, $src_volid, $sshinfo, $target_sid, {'target_volname' => $target_volname});
|
||||||
|
|
||||||
print "DEBUG: end worker $upid\n";
|
print "DEBUG: end worker $upid\n";
|
||||||
|
|
||||||
|
|||||||
@ -563,10 +563,17 @@ sub abs_filesystem_path {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub storage_migrate {
|
sub storage_migrate {
|
||||||
my ($cfg, $volid, $target_sshinfo, $target_storeid, $target_volname, $base_snapshot, $snapshot, $ratelimit_bps, $insecure, $with_snapshots, $logfunc) = @_;
|
my ($cfg, $volid, $target_sshinfo, $target_storeid, $opts, $logfunc) = @_;
|
||||||
|
|
||||||
|
my $base_snapshot = $opts->{base_snapshot};
|
||||||
|
my $snapshot = $opts->{snapshot};
|
||||||
|
my $ratelimit_bps = $opts->{ratelimit_bps};
|
||||||
|
my $insecure = $opts->{insecure};
|
||||||
|
my $with_snapshots = $opts->{with_snapshots} ? 1 : 0;
|
||||||
|
my $allow_rename = $opts->{allow_rename} ? 1 : 0;
|
||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid);
|
my ($storeid, $volname) = parse_volume_id($volid);
|
||||||
$target_volname = $volname if !$target_volname;
|
my $target_volname = $opts->{target_volname} || $volname;
|
||||||
|
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
|
|
||||||
@ -609,7 +616,6 @@ sub storage_migrate {
|
|||||||
$import_fn = "tcp://$net";
|
$import_fn = "tcp://$net";
|
||||||
}
|
}
|
||||||
|
|
||||||
$with_snapshots = $with_snapshots ? 1 : 0; # sanitize for passing as cli parameter
|
|
||||||
my $send = ['pvesm', 'export', $volid, $format, '-', '-with-snapshots', $with_snapshots];
|
my $send = ['pvesm', 'export', $volid, $format, '-', '-with-snapshots', $with_snapshots];
|
||||||
my $recv = [@$ssh, '--', 'pvesm', 'import', $target_volid, $format, $import_fn, '-with-snapshots', $with_snapshots];
|
my $recv = [@$ssh, '--', 'pvesm', 'import', $target_volid, $format, $import_fn, '-with-snapshots', $with_snapshots];
|
||||||
if (defined($snapshot)) {
|
if (defined($snapshot)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user