[pve-devel] [PATCH v3 storage 2/2] Avoid using extra variable
Fabian Ebner
f.ebner at proxmox.com
Mon Feb 17 12:41:24 CET 2020
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/Storage/ZFSPoolPlugin.pm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index dbe0465..b29fba5 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -645,8 +645,6 @@ sub create_base {
sub volume_resize {
my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
- my $new_size = $size;
-
my (undef, $vname, undef, undef, undef, undef, $format) =
$class->parse_volname($volname);
@@ -654,13 +652,13 @@ sub volume_resize {
# align size to 1M so we always have a valid multiple of the volume block size
if ($format eq 'raw') {
- my $padding = (1024 - $new_size % 1024) % 1024;
- $new_size = $new_size + $padding;
+ my $padding = (1024 - $size % 1024) % 1024;
+ $size = $size + $padding;
}
- $class->zfs_request($scfg, undef, 'set', "$attr=${new_size}k", "$scfg->{pool}/$vname");
+ $class->zfs_request($scfg, undef, 'set', "$attr=${size}k", "$scfg->{pool}/$vname");
- return $new_size;
+ return $size;
}
sub storage_can_replicate {
--
2.20.1
More information about the pve-devel
mailing list