From 8e5b96cac3404aeffde2ceab9f09cc5958e88888 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 4 Apr 2016 08:51:13 +0200 Subject: [PATCH] zfs_parse_zvol_list: simplify regex --- PVE/Storage/ZFSPoolPlugin.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm index aeb267a..c381648 100644 --- a/PVE/Storage/ZFSPoolPlugin.pm +++ b/PVE/Storage/ZFSPoolPlugin.pm @@ -129,9 +129,10 @@ sub zfs_parse_zvol_list { sub parse_volname { my ($class, $volname) = @_; - if ($volname =~ m/^(((base|vm|basevol)-(\d+)-\S+)\/)?((base|basevol)?(vm|subvol)?-(\d+)-\S+)$/) { - my $format = ($7 && $7 eq 'subvol') || ( $6 && $6 eq 'basevol') ? 'subvol' : 'raw'; - return ('images', $5, $8, $2, $4, $6, $format); + if ($volname =~ m/^(((base|basevol)-(\d+)-\S+)\/)?((base|basevol|vm|subvol)-(\d+)-\S+)$/) { + my $format = ($6 eq 'subvol' || $6 eq 'basevol') ? 'subvol' : 'raw'; + my $isBase = ($6 eq 'base' || $6 eq 'basevol'); + return ('images', $5, $7, $2, $4, $isBase, $format); } die "unable to parse zfs volume name '$volname'\n";