On Sun, Dec 19, 2021 at 10:27:48AM +0000, Richard W.M. Jones wrote:
On Sun, Dec 19, 2021 at 09:09:39AM +0200, Nir Soffer wrote:
> The plugin used "i" (int32) instead of "I" (uint32) for the
count, so
> when the client asks for 4294966784 bytes, the python plugin got -512.
>
> nbdkit: python.0: debug: python: extents count=4294966784 offset=0 req_one=0
> ...
> nbdkit: python.0: debug: extents: count=-512 offset=0 flags=0
>
> With this fix I can get extents from rhv-upload-plugin using nbdinfo.
> ---
> plugins/python/plugin.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/plugins/python/plugin.c b/plugins/python/plugin.c
> index f85512b4..366619f9 100644
> --- a/plugins/python/plugin.c
> +++ b/plugins/python/plugin.c
> @@ -957,21 +957,21 @@ py_extents (void *handle, uint32_t count, uint64_t offset,
> ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE;
> struct handle *h = handle;
> PyObject *fn;
> PyObject *r;
> PyObject *iter, *t;
> size_t size;
>
> if (callback_defined ("extents", &fn)) {
> PyErr_Clear ();
>
> - r = PyObject_CallFunction (fn, "OiLI", h->py_h, count, offset,
flags);
> + r = PyObject_CallFunction (fn, "OILI", h->py_h, count, offset,
flags);
> Py_DECREF (fn);
> if (check_python_failure ("extents") == -1)
> return -1;
>
> iter = PyObject_GetIter (r);
> if (iter == NULL) {
> nbdkit_error ("extents method did not return "
> "something which is iterable");
> Py_DECREF (r);
> return -1;
ACKed and pushed, thanks.
I think we're going to need this one in RHEL ...
Included in nbdkit-1.28.3-3.el9
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW