mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2024-12-23 17:34:34 +03:00
zfs: volume import: use correct format for renaming
Previously, the transport format (which currently is always 'zfs') was
passed in, resulting in subvol-disks not to be renamed correctly.
Fixes: a97d3ee
("Introduce allow_rename parameter for pvesm import and storage_migrate")
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
eba7935f83
commit
726c432964
@ -770,7 +770,9 @@ sub volume_import {
|
|||||||
die "internal error: invalid file handle for volume_import\n"
|
die "internal error: invalid file handle for volume_import\n"
|
||||||
if !defined($fd);
|
if !defined($fd);
|
||||||
|
|
||||||
my (undef, $dataset, $vmid) = $class->parse_volname($volname);
|
my (undef, $dataset, $vmid, undef, undef, undef, $volume_format) =
|
||||||
|
$class->parse_volname($volname);
|
||||||
|
|
||||||
my $zfspath = "$scfg->{pool}/$dataset";
|
my $zfspath = "$scfg->{pool}/$dataset";
|
||||||
my $suffix = defined($base_snapshot) ? "\@$base_snapshot" : '';
|
my $suffix = defined($base_snapshot) ? "\@$base_snapshot" : '';
|
||||||
my $exists = 0 == run_command(['zfs', 'get', '-H', 'name', $zfspath.$suffix],
|
my $exists = 0 == run_command(['zfs', 'get', '-H', 'name', $zfspath.$suffix],
|
||||||
@ -780,7 +782,7 @@ sub volume_import {
|
|||||||
} elsif ($exists) {
|
} elsif ($exists) {
|
||||||
die "volume '$zfspath' already exists\n" if !$allow_rename;
|
die "volume '$zfspath' already exists\n" if !$allow_rename;
|
||||||
warn "volume '$zfspath' already exists - importing with a different name\n";
|
warn "volume '$zfspath' already exists - importing with a different name\n";
|
||||||
$dataset = $class->find_free_diskname($storeid, $scfg, $vmid, $format);
|
$dataset = $class->find_free_diskname($storeid, $scfg, $vmid, $volume_format);
|
||||||
$zfspath = "$scfg->{pool}/$dataset";
|
$zfspath = "$scfg->{pool}/$dataset";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user