]> git.proxmox.com Git - pve-storage.git/commitdiff
workaround zfs create -V error for unaligned sizes
authorMira Limbeck <m.limbeck@proxmox.com>
Fri, 29 Mar 2019 09:13:10 +0000 (10:13 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 30 Mar 2019 14:38:35 +0000 (15:38 +0100)
fixes the 'cannot create 'nvme/foo': volume size must be a multiple of
volume block size' error by always rounding the size up to the next 1M
boundary. this is a workaround until
https://github.com/zfsonlinux/zfs/issues/8541 is solved.
the current manpage says 128k is the maximum blocksize, but a local test
showed that values up to 1M are allowed. it might be possible to
increase it even further (see f1512ee61).

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
PVE/Storage/ZFSPoolPlugin.pm

index 6e0845752a002d02f8da50978de4330ba104ce8b..4bf6d50c03c379a3afcdb27c515d71d13a5fad6b 100644 (file)
@@ -309,7 +309,12 @@ sub zfs_get_pool_stats {
 
 sub zfs_create_zvol {
     my ($class, $scfg, $zvol, $size) = @_;
-    
+
+    # always align size to 1M as workaround until
+    # https://github.com/zfsonlinux/zfs/issues/8541 is solved
+    my $padding = (1024 - $size % 1024) % 1024;
+    $size = $size + $padding;
+
     my $cmd = ['create'];
 
     push @$cmd, '-s' if $scfg->{sparse};