mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-07-08 16:58:59 +03:00
When resizing a ZFS volume, align size to 1M
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>
This commit is contained in:
committed by
Thomas Lamprecht
parent
3ea55f0532
commit
d3e3e5d6bd
@ -662,6 +662,12 @@ sub volume_resize {
|
|||||||
|
|
||||||
my $attr = $format eq 'subvol' ? 'refquota' : 'volsize';
|
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");
|
$class->zfs_request($scfg, undef, 'set', "$attr=${new_size}k", "$scfg->{pool}/$vname");
|
||||||
|
|
||||||
return $new_size;
|
return $new_size;
|
||||||
|
Reference in New Issue
Block a user