Bug 890539

Summary: glance-cache-manage throws a warning: "UserWarning: The 'glance.client' module is deprecated in favor of the 'glanceclient' module"
Product: Red Hat OpenStack Reporter: Yaniv Kaul <ykaul>
Component: openstack-glanceAssignee: Eoghan Glynn <eglynn>
Status: CLOSED ERRATA QA Contact: Yaniv Kaul <ykaul>
Severity: low Docs Contact:
Priority: low    
Version: 2.0 (Folsom)CC: afazekas, apevec, jkt
Target Milestone: snapshot4Keywords: Triaged
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-glance-2012.2.3-2.el6ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-21 15:04:30 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Yaniv Kaul 2012-12-27 10:52:29 EST
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`
openstack-glance-2012.2.1-1.el6ost.noarch


Version-Release number of selected component (if applicable):
openstack-glance-2012.2.1-1.el6ost.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 2 Perry Myers 2013-01-03 11:40:26 EST
Solution here is to simply remove this binary from the spec file so that it is not installed by the RPM
Comment 3 Eoghan Glynn 2013-01-03 11:43:57 EST
Blacklist obsolete glance/client in the spec file to ensure these lingering dependencies fail fast.
Comment 4 Yaniv Kaul 2013-01-03 11:45:27 EST
(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?
Comment 5 Eoghan Glynn 2013-02-18 05:44:05 EST
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.

or:

(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.
Comment 6 Eoghan Glynn 2013-02-19 08:57:45 EST
After more investigation, I see that the deprecation warning has been effectively by-passed on the grizzly master with:

  https://github.com/openstack/glance/commit/05f1e1a8

(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.
Comment 7 Eoghan Glynn 2013-02-19 11:38:05 EST
Fix proposed to stable/folsom upstream:

  https://review.openstack.org/22305

(the CI failure is due to an transient issue with pypi).
Comment 9 Eoghan Glynn 2013-02-25 06:27:59 EST
Patch landed internally.
Comment 10 Eoghan Glynn 2013-02-27 04:33:57 EST
How to test
-----------

Simply run:

  $ glance-cache-manage list-cached

and note the lack of a deprecation warning on the glance.client module.
Comment 14 errata-xmlrpc 2013-03-21 15:04:30 EDT
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.

http://rhn.redhat.com/errata/RHBA-2013-0672.html