[pve-devel] [PATCH qemu-server] add discard_granularity to 4M for rbd storage
Alexandre Derumier
aderumier at odiso.com
Thu Jun 28 10:08:45 CEST 2018
when we have snapshots on rbd and do a trim, the space is increasing
http://tracker.ceph.com/issues/18352
we need to trim a full object (4MB by default), to be able to free space.
test:
without discard_granularity
---------------------------
vm-107-disk-1 20480M 2500M
vm-107-disk-1 20480M 2500M
vm-107-disk-1 at snap1 20480M 2500M
vm-107-disk-1 20480M 90112k
vm-107-disk-1 at snap1 20480M 2500M
vm-107-disk-1 20480M 1020M
with discard_granularity=4M
---------------------------
vm-107-disk-1 20480M 2500M
vm-107-disk-1 20480M 2500M
vm-107-disk-1 at snap1 20480M 2500M
vm-107-disk-1 20480M 90112k
vm-107-disk-1 at snap1 20480M 2500M
vm-107-disk-1 20480M 144M
---
PVE/QemuServer.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6a355f8..fd9754c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1695,6 +1695,11 @@ sub print_drivedevice_full {
$device .= ",serial=$serial";
}
+ my $volid = $drive->{file};
+ if($volid && $drive->{discard}) {
+ my $storage_name = PVE::Storage::parse_volume_id($volid);
+ $device .= ",discard_granularity=4194304" if $storecfg->{ids}->{$storage_name}->{type} eq 'rbd';
+ }
return $device;
}
--
2.11.0
More information about the pve-devel
mailing list