Richard W.M. Jones
2017-Jan-24 15:41 UTC
Re: [Libguestfs] [nbdkit PATCH 0/2] bind .zero to more languages
On Tue, Jan 24, 2017 at 03:16:45PM +0000, Richard W.M. Jones wrote:> However we could add another API: > > nbdkit_set_errno (int errno); > > This allows the plugin to send the errno back to the core code > explicitly. It's effectively stored as a global in the core code.What I'm really saying here is that at the moment (after your previous patch series) we have an implicit channel where errno is passed from the plugin to the core code. We should simply make that channel explicit and controlled by the plugin. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Eric Blake
2017-Jan-24 16:36 UTC
Re: [Libguestfs] [nbdkit PATCH 0/2] bind .zero to more languages
On 01/24/2017 09:41 AM, Richard W.M. Jones wrote:> On Tue, Jan 24, 2017 at 03:16:45PM +0000, Richard W.M. Jones wrote: >> However we could add another API: >> >> nbdkit_set_errno (int errno); >> >> This allows the plugin to send the errno back to the core code >> explicitly. It's effectively stored as a global in the core code. > > What I'm really saying here is that at the moment (after your previous > patch series) we have an implicit channel where errno is passed from > the plugin to the core code. We should simply make that channel > explicit and controlled by the plugin.Sounds reasonable. Do we really want plugins to report the full range of errno (using POSIX::errno in your perl example), or do we want the plugins to expose a new enum, with just the 5 or 6 errno values actually supported by the NBD protocol? I'm leaning towards each binding providing an enum of just the supported error values, in an nbd_ namespace, rather than tying directly to system errno values. Also, the NBD spec DOES allow for the server to send a string error message alongside the error code; we aren't utilizing that yet, but it would be worth exploring how easy it would be to let the plugin's error message be reflected through to the client. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Richard W.M. Jones
2017-Jan-24 16:42 UTC
Re: [Libguestfs] [nbdkit PATCH 0/2] bind .zero to more languages
On Tue, Jan 24, 2017 at 10:36:43AM -0600, Eric Blake wrote:> On 01/24/2017 09:41 AM, Richard W.M. Jones wrote: > > On Tue, Jan 24, 2017 at 03:16:45PM +0000, Richard W.M. Jones wrote: > >> However we could add another API: > >> > >> nbdkit_set_errno (int errno); > >> > >> This allows the plugin to send the errno back to the core code > >> explicitly. It's effectively stored as a global in the core code. > > > > What I'm really saying here is that at the moment (after your previous > > patch series) we have an implicit channel where errno is passed from > > the plugin to the core code. We should simply make that channel > > explicit and controlled by the plugin. > > Sounds reasonable. Do we really want plugins to report the full range of > errno (using POSIX::errno in your perl example), or do we want the > plugins to expose a new enum, with just the 5 or 6 errno values actually > supported by the NBD protocol? I'm leaning towards each binding > providing an enum of just the supported error values, in an nbd_ > namespace, rather than tying directly to system errno values.My feeling is we should expose the full set of errnos in this API. The core code should then map those down to the errno values supported by the protocol. My reasoning for this would be that the plugins shouldn't have to care about what errno values NBD supports, and NBD might support other errno values in future so baking this into the plugins doesn't sound like a good idea. Also it seems fine to use system errnos, since plugins are compiled on and tied to the system. (Contrast to libguestfs where we allow mixed appliance / host system, and in that case we have a module called errnostring which maps errnos to strings and back).> Also, the NBD spec DOES allow for the server to send a string error > message alongside the error code; we aren't utilizing that yet, but it > would be worth exploring how easy it would be to let the plugin's error > message be reflected through to the client.I didn't know that, but yes. 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/
Reasonably Related Threads
- Re: [nbdkit PATCH 0/2] bind .zero to more languages
- Re: [nbdkit PATCH 0/2] bind .zero to more languages
- Re: [nbdkit PATCH 0/2] bind .zero to more languages
- Re: [nbdkit PATCH 0/2] bind .zero to more languages
- Re: [nbdkit PATCH 0/2] bind .zero to more languages