[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] virt-sparsify --inline with Parallels/Virtuozzo Ploop Images



On Fri, Sep 27, 2019 at 12:00:58PM +0200, Pino Toscano wrote:
> On Thursday, 26 September 2019 16:29:46 CEST Jonathan Wright wrote:
> > virt-sparsify: error: libguestfs error: discard cannot be enabled on this
> > drive: qemu does not support discard for '*parallels*' format files
> 
> Correct, this is because we have the following function to determine
> whether it is supported:
> https://github.com/libguestfs/libguestfs/blob/02890096d55eaee66c1e6ed34fc9b235cc64ebd3/lib/qemu.c#L972
> In a nutshell:
> - raw supported with qemu >= 1.5
> - qcow2 supported with qemu >= 1.6
> - any other format is not supported

I wonder if it should just try to attach the image with discard=unmap
blockdev option, and bail out if that fails.  This will allow to support
any image format where the capability is present in QEMU (ATM these
appear to be just qcow2 and raw format drivers but there are also a few
protocol drivers (iscsi, nbd, sheepdog, gluster) which can be relevant
for virt-sparsify too).

> So we check based on the version of qemu currently.
> 
> > Since Virtuozzo 7.0.11 discard is officially supported for ploop images 
> > and I've mounted them with discard and confirmed this functionality 
> > works as expected.  Would it be possible to update libguestfs to be 
> > aware of this support so the --inplace flag will work?
> > 
> > https://virtuozzosupport.force.com/s/article/VZA-2019-059
> 
> This leads me to the question: how can libguestfs detect this? Ideally
> we would check somehow, and show the error message only when not
> supported. Otherwise the alternative is simply unconditionally enable
> discard for "parallels" disk images, although I don't know what would
> happen when using versions of Virtuozzo older than 7.0.11.

Please see my other message in this thread.  This is not a property of
the image format, but that of the driver.  And the driver in QEMU hasn't
changed so libguestfs doesn't need to adjust.  If discard support is
ever added to the QEMU parallels format driver, libguestfs will be able
to test for it in a way similar to what it does for qcow2 and raw.

Meanwhile there's a workaround to achieve the same effect with a
different tool.

Roman.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]