<div dir="auto">Thanks Sean, that makes much easier to code!<div dir="auto"><br></div><div dir="auto">```</div><div dir="auto">...</div><div dir="auto">conn = openstack.connect(cloud_name)</div><div dir="auto"><br></div><div dir="auto">with open(path, 'wb') as image_file:</div><div dir="auto">    response = conn.image.download_image(image_name)</div><div dir="auto">    for chunk in tqdm(response.iter_content(), **tqdm_params):</div><div dir="auto">        image_file.write(chunk)</div><div dir="auto">```</div><div dir="auto"><br></div><div dir="auto">And it gave me some performance improvement (3kB/s -> 120kB/s).</div>... though it would still take several days to download an image.<div dir="auto"><br></div><div dir="auto">Is there some tuning that I could apply?</div><div dir="auto"><br></div><div dir="auto"><div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Thu, Oct 13, 2022, 14:18 Sean Mooney <<a href="mailto:smooney@redhat.com">smooney@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, 2022-10-13 at 13:30 -0300, Lucio Seki wrote:<br>
> Hi glance experts,<br>
> <br>
> I'm using the following code to download a glance image:<br>
> <br>
> ```<br>
> from glanceapi import client<br>
> ...<br>
> glance = client.Client(GLANCE_API_VERSION, session=sess)<br>
> ...<br>
> with open(path, 'wb') as image_file:<br>
>     data = glance.images.data(image_id)<br>
>     for chunk in tqdm(data, unit='B', unit_scale=True, unit_divisor=1024):<br>
>         image_file.write(chunk)<br>
> ```<br>
> <br>
> And I get a speed around 3kB/s. It would take months to download an image.<br>
> I'm using python3-glanceclient==3.6.0.<br>
> I even tried:<br>
> ```<br>
>     for chunk in tqdm(data, unit='B', unit_scale=True, unit_divisor=1024):<br>
>         pass<br>
> ```<br>
> to see if the bottleneck was the disk I/O, but didn't get any faster.<br>
> <br>
> In the same environment, when I use the glance CLI instead:<br>
> <br>
> ```<br>
> glance image-download --file $path $image_id<br>
> ```<br>
> I get hundreds of MB/s download speed, and it finishes in a few minutes.<br>
> <br>
> Is there anything I can do to improve the glanceclient performance?<br>
> I'm considering using subprocess.Popen(['glance', 'image-download', ...])<br>
> if nothing helps...<br>
have you considered using the openstacksdk instead<br>
<br>
the glanceclint is really only intendeted for other openstack service to use like<br>
nova or ironic.<br>
its not really ment to be used to write your onw code anymore.<br>
in the past it provided a programatic interface for interacting with glance<br>
but now you shoudl prefer the openstack sdk instead.<br>
<a href="https://github.com/openstack/openstacksdk" rel="noreferrer noreferrer" target="_blank">https://github.com/openstack/openstacksdk</a><br>
<br>
> <br>
> Regards,<br>
> Lucio<br>
<br>
</blockquote></div></div></div></div>