virt-sparsify --inline with Parallels/Virtuozzo Ploop Images
virt-sparsify: error: libguestfs error: discard cannot be enabled on this drive: qemu does not support discard for '*parallels*' format files 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 "Native discard support in ploop enabling automatic discard requests on all ext4 filesystems over ploop block devices, except containers running on Virtuozzo Storage." -- Jonathan Wright KnownHost, LLC https://www.knownhost.com
Hi Jonathan, 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/02890096d55eaee66c1e6ed34fc9b2... In a nutshell: - raw supported with qemu >= 1.5 - qcow2 supported with qemu >= 1.6 - any other format is not supported 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?
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. Any Virtuozzo guy that can provide more insight? -- Pino Toscano
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/02890096d55eaee66c1e6ed34fc9b2... 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?
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.
On Thu, Sep 26, 2019 at 09:29:46AM -0500, Jonathan Wright wrote:
virt-sparsify: error: libguestfs error: discard cannot be enabled on this drive: qemu does not support discard for '*parallels*' format files
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?
libguestfs does its work by attaching the image to a virtual machine running in QEMU. So the ability of libguestfs to sparsify an image depends on the QEMU driver for that image format to support discard. Current parallels format driver in QEMU doesn't support it, and I'm unaware of anyone working on it.
https://virtuozzosupport.force.com/s/article/VZA-2019-059
"Native discard support in ploop enabling automatic discard requests on all ext4 filesystems over ploop block devices, except containers running on Virtuozzo Storage."
This refers to ploop block device driver in Virtuozzo kernel. It allows to present a parallels format image as a block device (similar to what traditional loop devices do with raw images). The feature you quote is that this driver gained the ability to handle discard requests to the ploop device by punching holes in the underlying image. So in order to achieve the same effect as virt-sparsify, you need to mount the image and call fstrim on the mountpoint. Roman.
participants (3)
-
Jonathan Wright -
Pino Toscano -
Roman Kagan