[Glance] create image by downloading/importing from UI vs. CLI

Tony Liu tonyliu0592 at hotmail.com
Sat Oct 24 20:37:44 UTC 2020


Hi,

The initial issue I saw was "The Store URI was malformed." from
Horizon when creating image by URL [1].

It works fine with Glance CLI as the following.
========
glance image-create --container-format bare --disk-format qcow2 --name cirros-test
glance image-import --import-method web-download --uri https://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img cirros-test
========

When I look into it, I see that UI and CLI work differently, they are
handled by different workflow in Glance. Why is that?
Why not UI follows the same workflow as CLI?

The root cause is that, [1] redirect to [2] and redirect to [3].
One issue here is that, query is not supported in [4]. pieces.query
is dropped. When I attached query parameters, I got 403. And that's
because, the workflow for UI is checking quota policy when adding
location. It needs to get the size of image by HEAD request.
But the signature in [3] is for GET request. So that HEAD request
is forbidden by S3.

I don't think we can get an URL with signature for HEAD request in
such case. So I go for an ugly workaround to skip the size check.
Any ideas to make it work better?

Is quota policy involved in CLI workflow? Again, can we make UI
work the same way as CLI?

[1] https://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
[2] https://github.com/cirros-dev/cirros/releases/download/0.5.1/cirros-0.5.1-x86_64-disk.img
[3] https://github-production-release-asset-2e65be.s3.amazonaws.com/219785102/6ebfbc00-5fb5-11ea-91bd-96a6baa1496d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201024%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201024T191926Z&X-Amz-Expires=300&X-Amz-Signature=0f49887e19f40bb969f0b033fba3c8986edc55fccdbea4b6003ef799fc055712&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=219785102&response-content-disposition=attachment%3B%20filename%3Dcirros-0.5.1-x86_64-disk.img&response-content-type=application%2Foctet-stream
[4] https://github.com/openstack/glance_store/blob/488d3e2fe31e4fc7a461e9de8b20df481d78daa2/glance_store/_drivers/http.py#L121


Thanks!
Tony




More information about the openstack-discuss mailing list