]> git.proxmox.com Git - pve-storage.git/commitdiff
When resizing a ZFS volume, align size to 1M
authorFabian Ebner <f.ebner@proxmox.com>
Mon, 9 Dec 2019 07:25:53 +0000 (08:25 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Dec 2019 13:07:50 +0000 (14:07 +0100)
The size is required to be a multiple of volblocksize. Make sure
that the requirement is always met, so ZFS won't complain when we do
things like 'qm resize 102 scsi1 +0.01G'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Storage/ZFSPoolPlugin.pm

index 456fb4037267726d55450bd831c3420d30f2984c..42aeedbd52572d7ebc910a017a690491993fd7bb 100644 (file)
@@ -662,6 +662,12 @@ sub volume_resize {
 
     my $attr = $format eq 'subvol' ? 'refquota' : 'volsize';
 
+    # 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;
+    }
+
     $class->zfs_request($scfg, undef, 'set', "$attr=${new_size}k", "$scfg->{pool}/$vname");
 
     return $new_size;