Bug 1649679

Summary: Glance doesn't clean up the staging area with default config
Product: Red Hat OpenStack Reporter: Thomas Hervé <therve>
Component: openstack-glanceAssignee: Abhishek Kekane <akekane>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Abrams <mabrams>
Severity: medium Docs Contact: Kim Nylander <knylande>
Priority: medium    
Version: 14.0 (Rocky)CC: akekane, eglynn, gfidente, joflynn, tenobreg
Target Milestone: ---Keywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Release Note
Doc Text:
When you use the web-download feature, the staging area - defined in the configuration using the `node_staging_uri` option - is not cleaned up properly. Ensure that `file` is part of the `stores` configuration option in the `glance_store` section of the glance-api.conf file.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 09:38:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas Hervé 2018-11-14 08:28:08 UTC
I tested the web-download import with glance on containers, and saw the following error in the glance logs:

 Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 53, in _execute_task
     result = task.execute(**arguments)
   File "/usr/lib/python2.7/site-packages/glance/async_/flows/api_image_import.py", line 92, in execute
     store_api.delete_from_backend(file_path)
   File "/usr/lib/python2.7/site-packages/glance_store/backend.py", line 409, in delete_from_backend
     loc = location.get_location_from_uri(uri, conf=CONF)
   File "/usr/lib/python2.7/site-packages/glance_store/location.py", line 75, in get_location_from_uri
     raise exceptions.UnknownScheme(scheme=pieces.scheme)
 UnknownScheme: Unknown scheme 'file' found in URI

The import worked though, and the image seems active.

I have the following defined the config:

node_staging_uri=file:///var/lib/glance/staging

It seems this area doesn't get cleaned up, and will get clutter over time.

I used glance in the undercloud with containers, but I don't think it would work in the overcloud either.

Comment 1 Thomas Hervé 2018-11-14 08:32:32 UTC
It looks like it was present since the beginning, too:

https://bugzilla.redhat.com/show_bug.cgi?id=1418436#c8

Comment 2 Cyril Roelandt 2018-11-14 16:16:44 UTC
So, I talked to Thomas. If he adds "file" to the list of stores in glance-api.conf, everything works as expected. I do not think that this is especially user-friendly, though. Shouldn't we automagically load the "file" store? This could be done in the _DeleteFromFS class:

https://github.com/openstack/glance/blob/master/glance/async_/flows/api_image_import.py#L78

We already use this workaround here:

https://github.com/openstack/glance/blob/master/glance/async_/flows/api_image_import.py#L149

@Abhishek: do you think upstream would be ok with this?

Comment 4 Thomas Hervé 2018-11-15 07:47:42 UTC
Opened https://bugs.launchpad.net/glance/+bug/1803498.

Comment 5 Abhishek Kekane 2018-11-16 05:37:02 UTC
Hi Cyril, Thomas,

I have proposed a upstream fix for this issue.
Please refer, https://review.openstack.org/618468