[Libguestfs] [PATCH 3/6] v2v: rhv-upload-plugin: Get imageio connections limits

Nir Soffer nsoffer at redhat.com
Fri Jan 22 23:02:34 UTC 2021


On Sat, Jan 23, 2021 at 12:45 AM Nir Soffer <nirsof at gmail.com> wrote:
>
> In imageio >= 2.0 the server reports the maximum number of readers and
> writers. We will use these limits when creating a connection pool to the
> server.
>
> Signed-off-by: Nir Soffer <nsoffer at redhat.com>
> ---
>  v2v/rhv-upload-plugin.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
> index 0f8101dd..e639be0c 100644
> --- a/v2v/rhv-upload-plugin.py
> +++ b/v2v/rhv-upload-plugin.py
> @@ -136,6 +136,7 @@ def open(readonly):
>
>      debug("imageio features: flush=%(can_flush)r "
>            "zero=%(can_zero)r unix_socket=%(unix_socket)r"
> +          "max_readers=%(max_readers)r max_writers=%(max_writers)r"
>            % options)

I forgot a space at the end, we see now

    imageio features: flush=True zero=True
unix_socket='\x00/org/ovirt/imageio'max_readers=8 max_writers=8

>
>      # Save everything we need to make requests in the handle.
> @@ -700,6 +701,8 @@ def get_options(http, url):
>              "can_flush": "flush" in features,
>              "can_zero": "zero" in features,
>              "unix_socket": j.get('unix_socket'),
> +            "max_readers": j.get("max_readers", 1),
> +            "max_writers": j.get("max_writers", 1),
>          }
>
>      elif r.status == 405 or r.status == 204:
> @@ -709,6 +712,8 @@ def get_options(http, url):
>              "can_flush": False,
>              "can_zero": False,
>              "unix_socket": None,
> +            "max_readers": 1,
> +            "max_writers": 1,
>          }
>      else:
>          raise RuntimeError("could not use OPTIONS request: %d: %s" %
> --
> 2.26.2
>




More information about the Libguestfs mailing list