[Libguestfs] [PATCH 0/3] Cleanups for ovirt 4.4

Richard W.M. Jones rjones at redhat.com
Fri Jan 22 08:49:44 UTC 2021


By the way if you happen to be looking at the Python plugin, then
there are two changes that may be worth using.

API_VERSION = 2:

  https://libguestfs.org/nbdkit-python-plugin.3.html#API-versions

and multi-thread support:

  https://libguestfs.org/nbdkit-python-plugin.3.html#Threads

These were both added (by you) and are both available in nbdkit >= 1.22,
which is now available in RHEL AV >= 8.3.0 so there's no reason why we
can't use them now.

I don't think there's any advantage to API_VERSION = 2 because the
plugin is very (exclusively?) write-heavy.  But a more parallel thread
model is surely advantageous?

For API_VERSION = 2, the changes are:

* pread signature changes to:

  def pread(h, buf, offset, flags) -> returns nothing

  - You have to write the result directly into the buf parameter,
    avoiding the extra copy.

* pwrite adds flags parameter:

  def pwrite(h, buf, offset, flags) -> returns nothing

* flush, trim also add flags parameter.

* zero changes signature completely, removing the may_trim parameter
  and adding a general flags parameter in its place.

For threads:

* Add a thread_model() function with no parameters which returns
  nbdkit.THREAD_MODEL_PARALLEL or nbdkit.THREAD_MODEL_SERIALIZE_REQUESTS.
  Of course locking will need to be introduced (especially for
  PARALLEL) to protect internal data structures.  See nbdkit-plugin(3)
  for an explanation of the thread models.

You'll also have to change the minimum version of nbdkit so that older
versions get rejected, here:

  https://github.com/libguestfs/virt-v2v/blob/1d5fc257765c444644e5bfc6525e86ff201755f0/v2v/output_rhv_upload.ml#L87

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list