[pve-devel] [PATCH qemu-server] Fix #1242 : clone_disk : call qga fstrim after clone

Alwin Antreich a.antreich at proxmox.com
Tue May 29 14:03:09 CEST 2018


On Tue, May 29, 2018 at 10:02:45AM +0200, Alexandre DERUMIER wrote:
> >>I would think, the best is to have it in the vmid.conf itself, as maybe there 
> >>is one VM where I want to have flat images (eg. DB server) and not for the 
> >>rest. 
> 
> But I think that if user want flat image, it'll not use the discard option for disk ? 
> (so fstrim don't do nothing)
True.

> 
> 
> I think we need an explicit option like "do fstrim or not after clone disk", more like if user don't want fstrim overhead
> on the storage.
With the above in mind the storage.cfg sounds to me as the better place.

On the other hand, as this is a work-around for the underlying problem,
of qemu mirror not being able to detect zeros in data. Might it not be
easier to throw in an API call afterwards that does the fstrim? Would be
less to think about and maintain, till qemu can do it out-of-the-box.

# pvesh create /nodes/{node}/qemu/{vmid}/agent/fstrim
or by hand
# qm agent <vmid> fstrim

I assume, there are only two use cases with fstrim:

*) many machines, clones and migrations
    In this case, there is for sure some automation going on and the
    user would call the API after each action taken. This way the fstrim
    can be run controlled (eg. monitor IO load).

*) few machines, seldom cloning or migration
    Here the user would do manual run of the command or has a small
    script inside/outside the VM that runs the fstrim.





More information about the pve-devel mailing list