]> git.proxmox.com Git - pve-storage.git/commitdiff
Enable unmap support
authorDaniel Berteaud <daniel@firewall-services.com>
Wed, 18 Sep 2019 15:15:45 +0000 (17:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 23 Sep 2019 14:09:10 +0000 (16:09 +0200)
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 <daniel@firewall-services.com>
PVE/Storage/LunCmd/LIO.pm

index 1ddc02d4f58780fa726e874cfc0e535c4e57c3b6..f246dbbb55d67e2a71b7fcf76eea6596a0c22bcd 100644 (file)
@@ -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);