[pve-devel] [PATCH storage] workaround zfs create -V error for unaligned sizes
Mira Limbeck
m.limbeck at proxmox.com
Fri Mar 29 10:11:22 CET 2019
fixes the 'cannot create '...': 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 at proxmox.com>
---
PVE/Storage/ZFSPoolPlugin.pm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 6e08457..246c0f1 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -309,7 +309,12 @@ sub zfs_get_pool_stats {
sub zfs_create_zvol {
my ($class, $scfg, $zvol, $size) = @_;
-
+
+ # always align size to 128k as workaround until
+ # https://github.com/zfsonlinux/zfs/issues/8541 is solved
+ my $padding = (128 - $size % 128) % 128;
+ $size = $size + $padding;
+
my $cmd = ['create'];
push @$cmd, '-s' if $scfg->{sparse};
--
2.11.0
More information about the pve-devel
mailing list