libvirt-override.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Commit 2b4bd07e0a22 (Add check for params, nparams being a dictionary)
changed the way the optional params argument is treated. If
libvirt.virDomain.blockCopy() is called without specifying params,
params is None, and the call will fail with:
TypeError: block params must be a dictionary
This is wrong as params is defined as kwarg, breaking existing libvirt
users like oVirt. Add a check for Py_None, so we accept either a dict or
None and fail with TypeError with anything else.
Resolves: https://bugzilla.redhat.com/1687114
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
---
libvirt-override.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 857c018..c5e2908 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8835,11 +8835,11 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED,
if (virPyDictToTypedParams(pyobj_dict, ¶ms, &nparams,
virPyDomainBlockCopyParams,
VIR_N_ELEMENTS(virPyDomainBlockCopyParams)) < 0) {
return NULL;
}
- } else {
+ } else if (pyobj_dict != Py_None) {
PyErr_Format(PyExc_TypeError, "block params must be a dictionary");
return NULL;
}
dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
--
2.17.2
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Mar 11, 2019 at 11:35 PM Nir Soffer <nirsof@gmail.com> wrote:
> Commit 2b4bd07e0a22 (Add check for params, nparams being a dictionary)
> changed the way the optional params argument is treated. If
> libvirt.virDomain.blockCopy() is called without specifying params,
> params is None, and the call will fail with:
>
> TypeError: block params must be a dictionary
>
> This is wrong as params is defined as kwarg, breaking existing libvirt
> users like oVirt. Add a check for Py_None, so we accept either a dict or
> None and fail with TypeError with anything else.
>
> Resolves: https://bugzilla.redhat.com/1687114
>
> Signed-off-by: Nir Soffer <nsoffer@redhat.com>
> ---
> libvirt-override.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libvirt-override.c b/libvirt-override.c
> index 857c018..c5e2908 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -8835,11 +8835,11 @@ libvirt_virDomainBlockCopy(PyObject *self
> ATTRIBUTE_UNUSED,
> if (virPyDictToTypedParams(pyobj_dict, ¶ms, &nparams,
> virPyDomainBlockCopyParams,
>
> VIR_N_ELEMENTS(virPyDomainBlockCopyParams)) < 0) {
> return NULL;
> }
> - } else {
> + } else if (pyobj_dict != Py_None) {
> PyErr_Format(PyExc_TypeError, "block params must be a
> dictionary");
> return NULL;
> }
>
> dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
> --
> 2.17.2
>
>
Tested with oVirt master and qemu master, live storage migration completed
successfully.
Nir
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Mar 11, 2019 at 23:34:50 +0200, Nir Soffer wrote: > Commit 2b4bd07e0a22 (Add check for params, nparams being a dictionary) > changed the way the optional params argument is treated. If > libvirt.virDomain.blockCopy() is called without specifying params, > params is None, and the call will fail with: > > TypeError: block params must be a dictionary > > This is wrong as params is defined as kwarg, breaking existing libvirt > users like oVirt. Add a check for Py_None, so we accept either a dict or > None and fail with TypeError with anything else. > > Resolves: https://bugzilla.redhat.com/1687114 > > Signed-off-by: Nir Soffer <nsoffer@redhat.com> > --- > libvirt-override.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) ACK && pushed. Thanks for fixing this. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.