[libvirt] [PATCH 2/3] fdstream: introduce virFDStreamOpenBlockDevice

Roman Bogorodskiy bogorodskiy at gmail.com
Fri Aug 15 08:55:58 UTC 2014


  Daniel P. Berrange wrote:

> On Fri, Aug 15, 2014 at 12:44:21PM +0400, Roman Bogorodskiy wrote:
> > virStorageBackendVolDownloadLocal and virStorageBackendVolUploadLocal
> > use virFDStreamOpenFile function to work with the volume fd.
> > 
> > virFDStreamOpenFile calls virFDStreamOpenFileInternal that implements
> > handling of the non-blocking I/O. If a file is not a character device and
> > not a fifo, it uses libvirt_iohelper.
> > 
> > On FreeBSD, it doesn't work as expected because disks are exposed as
> > character devices.
> 
> Why does that cause a problem ? The reason we use iohelper is because
> POSIX does not have O_NONBLOCK work on plain files, so we need to use
> the iohelper so that we have a pipe we can set O_NONBLOCK on. If FreeBSD
> disks are character devices though, O_NONBLOCK should work fine on them
> avoiding the need for iohelper.

O_NONBLOCK doesn't work for some reason, at least on ZFS volumes:
fcntl() fails with:

fcntl: Inappropriate ioctl for device

I have asked a question on an appropriate mailing list:

https://lists.freebsd.org/pipermail/freebsd-fs/2014-August/019923.html

I've also included a test program I use to reproduce that there.

> 
> 
> Regards,
> Daniel
> -- 
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140815/a12d2df6/attachment-0001.sig>


More information about the libvir-list mailing list