5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-25 06:03:53 +03:00

Parse volname where needed

The common ZFSPlugin was missing volume name parsing
in a few places. This was not a problem for standard
volumes, but broke functionnalities (like resize,
snapshot, rollback) with linked clones as the name of
the zvol must be extracted from the entry in the config
(remove base-X-disk-Y prefix)

Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
This commit is contained in:
Daniel Berteaud 2019-09-18 17:15:46 +02:00 committed by Thomas Lamprecht
parent b7c8738f17
commit c243be83b4

View File

@ -101,6 +101,8 @@ sub zfs_get_lu_name {
my $base = $zfs_get_base->($scfg);
$zvol = ($class->parse_volname($zvol))[1];
my $object = ($zvol =~ /^.+\/.+/) ? "$base/$zvol" : "$base/$scfg->{pool}/$zvol";
my $lu_name = $class->zfs_request($scfg, undef, 'list_lu', $object);
@ -321,7 +323,9 @@ sub free_image {
sub volume_resize {
my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
$volname = ($class->parse_volname($volname))[1];
my $new_size = $class->SUPER::volume_resize($scfg, $storeid, $volname, $size, $running);
$class->zfs_resize_lu($scfg, $volname, $new_size);
@ -332,12 +336,16 @@ sub volume_resize {
sub volume_snapshot_delete {
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
$volname = ($class->parse_volname($volname))[1];
$class->zfs_request($scfg, undef, 'destroy', "$scfg->{pool}/$volname\@$snap");
}
sub volume_snapshot_rollback {
my ($class, $scfg, $storeid, $volname, $snap) = @_;
$volname = ($class->parse_volname($volname))[1];
$class->zfs_delete_lu($scfg, $volname);
$class->zfs_request($scfg, undef, 'rollback', "$scfg->{pool}/$volname\@$snap");