[Libguestfs] [nbdkit PATCH v2 0/5] FUA support in Python scripts

Eric Blake eblake at redhat.com
Wed Apr 11 05:03:37 UTC 2018


First out of our four language bindings to add FUA support (for
reference, I added 'zero' support for python, perl, and ruby
back in 1.1.13, then Rich had to add it for ocaml in 1.1.20).
I tested this heavily under python 2, but for now only compile
tested under python 3; I plan to do further testing there and
make any tweaks if necessary.

I wrote patch 5 early on, but then realized I probably don't have
a use for it if we fix the C code to cache for all plugins, so
it's more for information than for applying.  (It would matter
if we ever had any per-connection state beyond the script's
handle, and which would not also be cached on our behalf by
the main nbdkit code).

Something I thought of while writing patch 4, but haven't explored
yet, would be using attribute((cleanup)) to automatically call
Py_XDECREF() in a lot more places, for more compact code (it felt
like a lot of boilerplate to avoid leaks of python objects on all
exit paths).

Eric Blake (5):
  python: Let zero's may_trim parameter be optional
  python: Expose can_zero callback
  python: Update internals to plugin API level 2
  python: Expose FUA support
  RFC: python: Track and cache per-connection state in C struct

 plugins/python/nbdkit-python-plugin.pod |  85 ++++++-
 plugins/python/python.c                 | 388 ++++++++++++++++++++++++++------
 plugins/python/example.py               |   6 +-
 tests/test.py                           |   6 +-
 4 files changed, 408 insertions(+), 77 deletions(-)

-- 
2.14.3




More information about the Libguestfs mailing list