Red Hat Bugzilla – Bug 890539
glance-cache-manage throws a warning: "UserWarning: The 'glance.client' module is deprecated in favor of the 'glanceclient' module"
Last modified: 2016-04-26 09:22:49 EDT
Description of problem:
[root@ykaul-os-horizon ~(keystone_admin)]$ glance-cache-manage list-cached
/usr/bin/glance-cache-manage:40: UserWarning: The 'glance.client' module is deprecated in favor of the 'glanceclient' module provided by python-glanceclient (see http://github.com/openstack/python-glanceclient).
from glance import client as glance_client
Found 1 cached images...
ID Last Accessed (UTC) Last Modified (UTC) Size Hits
------------------------------------ ------------------- ------------------- -------------- ----------
a92439a6-5923-4ca8-98ae-ceabe3c164f6 0.0 1356610380.5 101920768 0
[root@ykaul-os-horizon ~(keystone_admin)]$ rpm -qf `which glance-cache-manage`
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Solution here is to simply remove this binary from the spec file so that it is not installed by the RPM
Blacklist obsolete glance/client in the spec file to ensure these lingering dependencies fail fast.
(In reply to comment #2)
> Solution here is to simply remove this binary from the spec file so that it
> is not installed by the RPM
Which binary? We need glance-cache-manage, AFAIK. What replaces it?
Thinking about this some more ... I'm not convinced that simply removing the glance-cache-manage binary from the spec file is the way to go here, as it'll remove some useful utilities providing users with control of the glance cache, e.g.:
- marking certain images as being eligible for pre-fetching
- listing the currently cached images on a particular host
- initiating eviction of cached images
Now of course all these operation are exposed via a RESTful API by the cachemanagement middleware, so could be invoked directly via curl or some such. However, the convenience provided by a special-purpose utility is worth preserving IMO.
So I would propose instead either:
(a) extend python-glanceclient to support the interaction with the cache management resource.
(b) modify glance.image_cache.client so that it extends the base client logic from python-glanceclient instead of the legacy glance.common.client.BaseClient.
Option (b) would be simpler from a packaging point of view, but option (a) may be the more correct option long term.
In any case, I'll consult with the glance PTL upstream before finalizing a strategy here.
After more investigation, I see that the deprecation warning has been effectively by-passed on the grizzly master with:
(i.e. the addition of a new thin image_cache client that extends a less derived base class in the legacy client library, and thus avoids the deprecation warning *without* rebasing on python-glanceclient).
We could either backport the above mentioned patch to stable/folsom, or even simpler, just swallow the deprecation warning with a warnings filter when used "internally" from the glance-cache-manage utility.
I prefer the latter approach as it's less intrusive on stable.
Essentially the warning on import of the legacy glance client is only useful as a signal to "external" usages of this deprecated library.
For internal usage such as the glance-cache-manage utility, it just exposes internal technical debt as an apparent user-facing warning, and thus has no real value.
Fix proposed to stable/folsom upstream:
(the CI failure is due to an transient issue with pypi).
Patch landed internally.
How to test
$ glance-cache-manage list-cached
and note the lack of a deprecation warning on the glance.client module.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.