[pve-devel] [PATCH storage V2 3/3] Parse volname where needed
Daniel Berteaud
daniel at firewall-services.com
Wed Sep 18 17:15:46 CEST 2019
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 at firewall-services.com>
---
PVE/Storage/ZFSPlugin.pm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index 1fac811..8c6709c 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -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");
--
2.21.0
More information about the pve-devel
mailing list