On Mon, Mar 12, 2018 at 07:13:52AM +0000, Nir Soffer wrote:
> On Fri, Mar 9, 2018 at 4:25 PM Richard W.M. Jones <rjo...@redhat.com> wrote:
> 
> > It has to be said it would be really convenient to have a 'zero'
> > and/or 'trim' method of some sort.
> >
> 
> 'trim' means discard?

Yes.  The 5 functions we could support are:

* pread  - done
* pwrite - done
* flush  - does fdatasync(2) on the block device
* zero   - write a range of zeroes without having to send zeroes
* trim   - punch hole, can be emulated using zero if not possile

Also (not implemented in nbdkit today, but coming soon), pwrite, zero
and trim can be extended with a FUA (force unit access) flag, which
would mean that the range should be persisted to disk before
returning.  It can be emulated by calling flush after the operation.

It wasn't clear if anything in this process flushes the content to
disk.  Is that what transfer.finalize does?

> Currently we cannot support discard on block storage since ovirt may
> need to wipe lvs when deleting a disk, and discarding may leave
> unwiped user data. This may change in 4.3 if we switch to wipe on
> creation instead of wipe after delete.

I think this depends on BLKDISCARDZEROES[1] for the block device?  Of
course if you're worried about data remanence for someone who has
access to the physical device then that wouldn't be enough.

[1] 
https://rwmj.wordpress.com/2014/03/11/blkdiscard-blkzeroout-blkdiscardzeroes-blksecdiscard/

> POST /images/ticket-id ...
> ...
> {
>     "op": "zero",
>     "offset": X,
>     "size": Y
> }
> 
> I would like to support only aligned offset and size - do you think it
> should work
> for qemu-img?

It depends a bit on what you mean by "aligned" and what the alignment
is.  We'd probably have to work around it in the plugin so that it can
round in the request, issues a zero operation for the aligned part,
and writes zeroes at each end.  There's no guarantee that qemu-img
will be well-behaved in the future even if it is now.

Anyway this sounds do-able, is it something we can get for 4.2?
How will we detect that the server supports it?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to