From b7c8738f17f1eae690fb9e8dd0a35c365632362c Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 18 Sep 2019 17:15:45 +0200 Subject: [PATCH] Enable unmap support In the default config, emulate_tpu is set to 0, which disables unmap support. Once enabled, trim can run from guest to reclaim free space. Signed-off-by: Daniel Berteaud --- PVE/Storage/LunCmd/LIO.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PVE/Storage/LunCmd/LIO.pm b/PVE/Storage/LunCmd/LIO.pm index 1ddc02d..f246dbb 100644 --- a/PVE/Storage/LunCmd/LIO.pm +++ b/PVE/Storage/LunCmd/LIO.pm @@ -250,7 +250,12 @@ my $create_lun = sub { my $res = $execute_remote_command->($scfg, $timeout, $targetcli, @cliparams); die $res->{msg} if !$res->{result}; - # step 2: register lun with target + # step 2: enable unmap support on the backstore + @cliparams = ($BACKSTORE . '/' . $volname, 'set', 'attribute', 'emulate_tpu=1' ); + $res = $execute_remote_command->($scfg, $timeout, $targetcli, @cliparams); + die $res->{msg} if !$res->{result}; + + # step 3: register lun with target # targetcli /iscsi/iqn.2018-04.at.bestsolution.somehost:target/tpg1/luns/ create /backstores/block/foobar @cliparams = ("/iscsi/$scfg->{target}/$tpg/luns/", 'create', "$BACKSTORE/$volname" ); $res = $execute_remote_command->($scfg, $timeout, $targetcli, @cliparams); -- 2.39.2