qvm-template-postprocess: call fstrim after removing image file
This is especially important on LVM thin pool, where space after removing the file needs to be given back to the pool, to be reused for other volumes (for example this template).
This commit is contained in:
parent
090cccd468
commit
4a9b57f91f
@ -214,6 +214,11 @@ def post_install(args):
|
||||
|
||||
if not args.keep_source:
|
||||
shutil.rmtree(args.dir)
|
||||
# if running as root, tell underlying storage layer about just freed
|
||||
# data blocks
|
||||
if os.getuid() == 0:
|
||||
subprocess.call(['sync', '-f', os.path.dirname(args.dir)])
|
||||
subprocess.call(['fstrim', os.path.dirname(args.dir)])
|
||||
|
||||
return 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user