Bug 893045 - 'glance-cache-manage list-cached' does not show 'last accessed' and 'last modified' fields in human-readable format'
Summary: 'glance-cache-manage list-cached' does not show 'last accessed' and 'last mod...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance
Version: 2.0 (Folsom)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: snapshot4
: 2.1
Assignee: Flavio Percoco
QA Contact: Kashyap Chamarthy
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-08 14:03 UTC by Yaniv Kaul
Modified: 2016-04-26 18:33 UTC (History)
5 users (show)

Fixed In Version: openstack-glance-2012.2.3-2.el6ost
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-21 19:04:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
adding glance-api-paste.ini for reference (1.90 KB, text/plain)
2013-03-19 12:20 UTC, Kashyap Chamarthy
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1102334 0 None None None Never
OpenStack gerrit 20118 0 None None None Never
Red Hat Product Errata RHBA-2013:0672 0 normal SHIPPED_LIVE Red Hat OpenStack 2.0 (Folsom) Preview bug fix and enhancement update 2013-03-21 23:02:46 UTC

Description Yaniv Kaul 2013-01-08 14:03:12 UTC
Description of problem:
[root@ykaul-os-glance images(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 2 cached images...
ID                                   Last Accessed (UTC) Last Modified (UTC) Size           Hits      
------------------------------------ ------------------- ------------------- -------------- ----------
a92439a6-5923-4ca8-98ae-ceabe3c164f6 0.0                 1356610380.5             101920768          0
b5379980-341a-454c-a811-5783ab5b9d52 1357651562.16       1357650338.09            283705344          2


The 'Last Accessed' and 'Last Modified' dates are not formatted.

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 Eoghan Glynn 2013-01-10 16:31:12 UTC
Confirmed, it would be a simple matter to convert from seconds since the epoch to iso8601 format before displaying.

Comment 9 Kashyap Chamarthy 2013-03-19 08:34:01 UTC
- Version Info:
================
$ rpm -q openstack-glance --changelog | grep 893045
- Prints list-cached dates in isoformat rhbz#893045
[tuser1@interceptor ~(keystone_admin)]$ 
$ rpm -q openstack-glance
openstack-glance-2012.2.3-7.el6ost.noarch

================


- Ensure the fix is in:
================
$ egrep -i 'iso8601' /usr/lib/python2.6/site-packages/glance/openstack/common/timeutils.py -A2
import iso8601


--
        return iso8601.parse_date(timestr)
    except iso8601.ParseError as e:
        raise ValueError(e.message)
    except TypeError as e:
--
def iso8601_from_timestamp(timestamp):
    """Returns a iso8601 formated date from timestamp"""
    return isotime(datetime.datetime.utcfromtimestamp(timestamp))
================


I have these setting enabled
================
# Address to find the registry server . # kashyap enabled this manually
registry_host = 0.0.0.0


# Port the registry server is listening on # kashyap enabled this manually
registry_port = 9191

[app:glance-pruner]
paste.app_factory = glance.image_cache.pruner:app_factory

[app:glance-prefetcher]
paste.app_factory = glance.image_cache.prefetcher:app_factory

[app:glance-cleaner]
paste.app_factory = glance.image_cache.cleaner:app_factory

[app:glance-queue-image]
paste.app_factory = glance.image_cache.queue_image:app_factory
================


Enable the log file 
================
$ sudo egrep -i log_file /etc/glance/glance-cache.conf 
log_file = /var/log/glance/image-cache.log
# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
$
================


And, enabled debug/verbose:
================
$ sudo egrep -i 'verbose|debug' /etc/glance/glance-cache.conf| grep -v ^$ | grep -v ^# 
verbose = True
debug = True
================


Restarted all glance services:
================
for j in `for i in $(ls -1 /etc/init.d/openstack-glance-*) ; do $i status | grep running ; done | awk '{print $1}'` ; do service $j restart ; done
================

And I still get this:
================
$ glance-cache-manage list-cached
Cache management middleware not enabled on host 0.0.0.0
================

glance-cache.log is not even present.
================
$ sudo ls /var/log/glance/*.log
/var/log/glance/api.log  /var/log/glance/registry.log  /var/log/glance/scrubber.log
================

Any hints how to "enable" cache management middleware ?

Comment 10 Kashyap Chamarthy 2013-03-19 08:37:46 UTC
Adding my glance-cache.conf for reference
================
$ sudo cat /etc/glance/glance-cache.conf| grep -v ^$ | grep -v ^# 
[DEFAULT]
verbose = True
debug = True
log_file = /var/log/glance/image-cache.log
image_cache_max_size = 10737418240
registry_host = 0.0.0.0
registry_port = 9191
[app:glance-pruner]
paste.app_factory = glance.image_cache.pruner:app_factory
[app:glance-prefetcher]
paste.app_factory = glance.image_cache.prefetcher:app_factory
[app:glance-cleaner]
paste.app_factory = glance.image_cache.cleaner:app_factory
[app:glance-queue-image]
paste.app_factory = glance.image_cache.queue_image:app_factory
================


Commmon glance commads do work:
================
$ glance image-list
+--------------------------------------+-----------+-------------+------------------+------------+--------+
| ID                                   | Name      | Disk Format | Container Format | Size       | Status |
+--------------------------------------+-----------+-------------+------------------+------------+--------+
| 40497881-5a89-4c39-b3f7-5d22db2fee51 | fedora-16 | qcow2       | bare             | 213581824  | active |
| 1e6292f9-82bd-4cdb-969e-c863cb1c6692 | fedora-17 | qcow2       | bare             | 251985920  | active |
| acc4c853-9153-4e80-b3c8-e253451ae983 | rhel63    | qcow2       | bare             | 1074135040 | active |
+--------------------------------------+-----------+-------------+------------------+------------+--------+
================


Setup info: glance, nova, keystone, cinder are configured on a single physical node, manually.

Comment 11 Kashyap Chamarthy 2013-03-19 12:10:18 UTC
VERIFIED

[tuser1@interceptor ~(keystone_admin)]$ glance-cache-manage list-cached
No cached images.
[tuser1@interceptor ~(keystone_admin)]$ 


Posting these for reference:
========================================
#  sudo cat /etc/glance/glance-cache.conf  | grep -v ^$ | grep -v ^# 
[DEFAULT]
verbose = True
debug = True
log_file = /var/log/glance/image-cache.log
image_cache_max_size = 10737418240
registry_host = 0.0.0.0
registry_port = 9191
[app:glance-pruner]
paste.app_factory = glance.image_cache.pruner:app_factory
[app:glance-prefetcher]
paste.app_factory = glance.image_cache.prefetcher:app_factory
[app:glance-cleaner]
paste.app_factory = glance.image_cache.cleaner:app_factory
[app:glance-queue-image]
paste.app_factory = glance.image_cache.queue_image:app_factory
========================================

Comment 12 Kashyap Chamarthy 2013-03-19 12:12:38 UTC
Adding for later reference: glance-cache.conf
========================================
[root@interceptor glance(keystone_admin)]#  sudo cat /etc/glance/glance-cache.conf  | grep -v ^$ | grep -v ^# 
[DEFAULT]
verbose = True
debug = True
log_file = /var/log/glance/image-cache.log
image_cache_max_size = 10737418240
registry_host = 0.0.0.0
registry_port = 9191
[app:glance-pruner]
paste.app_factory = glance.image_cache.pruner:app_factory
[app:glance-prefetcher]
paste.app_factory = glance.image_cache.prefetcher:app_factory
[app:glance-cleaner]
paste.app_factory = glance.image_cache.cleaner:app_factory
[app:glance-queue-image]
paste.app_factory = glance.image_cache.queue_image:app_factory
[root@interceptor glance(keystone_admin)]# 
========================================

Comment 13 Kashyap Chamarthy 2013-03-19 12:20:38 UTC
Created attachment 712615 [details]
adding glance-api-paste.ini for reference

Comment 17 Ami Jeain 2013-03-20 07:41:08 UTC
(In reply to comment #11)
> VERIFIED
> 
> [tuser1@interceptor ~(keystone_admin)]$ glance-cache-manage list-cached
> No cached images.

Kashyap, please verify the initial bug is fixed - that the time and dates are indeed humanly readable.

Comment 18 Kashyap Chamarthy 2013-03-20 09:21:18 UTC
Some context: 
=============
So, first we have to queue the image, then call the glance-cache-prefetcher, only then we could this. Thanks to Flavico for providing this esoteric info:



-> list the image:
================
$ glance image-list
+--------------------------------------+-----------+-------------+------------------+------------+--------+
| ID                                   | Name      | Disk Format | Container Format | Size       | Status |
+--------------------------------------+-----------+-------------+------------------+------------+--------+
| 40497881-5a89-4c39-b3f7-5d22db2fee51 | fedora-16 | qcow2       | bare             | 213581824  | active |
| 1e6292f9-82bd-4cdb-969e-c863cb1c6692 | fedora-17 | qcow2       | bare             | 251985920  | active |
| acc4c853-9153-4e80-b3c8-e253451ae983 | rhel63    | qcow2       | bare             | 1074135040 | active |
+--------------------------------------+-----------+-------------+------------------+------------+--------+
================

-> queue the image
================
$ glance-cache-manage queue-image 40497881-5a89-4c39-b3f7-5d22db2fee51
Queue image 40497881-5a89-4c39-b3f7-5d22db2fee51 for caching? [y/N] y
================


================
$ glance-cache-prefetcher 
Traceback (most recent call last):
  File "/usr/bin/glance-cache-prefetcher", line 49, in <module>
    config.parse_cache_args()
  File "/usr/lib/python2.6/site-packages/glance/common/config.py", line 77, in parse_cache_args
    return parse_args(args=args, default_config_files=config_files)
  File "/usr/lib/python2.6/site-packages/glance/common/config.py", line 72, in parse_args
    default_config_files=default_config_files)
  File "/usr/lib/python2.6/site-packages/glance/openstack/common/cfg.py", line 1028, in __call__
    self._parse_config_files()
  File "/usr/lib/python2.6/site-packages/glance/openstack/common/cfg.py", line 1498, in _parse_config_files
    raise ConfigFilesNotFoundError(not_read_ok)
glance.openstack.common.cfg.ConfigFilesNotFoundError: Failed to read some config files: /usr/share/glance/glance-cache-dist.conf,/etc/glance/glance-cache.conf
================

Why can't it read, the files still exist.
================
$ sudo ls -al /etc/glance/glance-cache.conf /usr/share/glance/glance-cache-dist.conf
-rw-r-----. 1 root glance 493 Mar 19 14:47 /etc/glance/glance-cache.conf
-rw-r-----. 1 root glance 116 Mar 14 05:16 /usr/share/glance/glance-cache-dist.conf
================

Comment 21 Kashyap Chamarthy 2013-03-20 10:14:52 UTC
Sorry about that, some more investigation needed, now VERIFIED:

Now they're in readable form
=============
# glance-cache-manage list-cached
Found 1 cached images...
ID                                   Last Accessed (UTC) Last Modified (UTC) Size           Hits      
------------------------------------ ------------------- ------------------- -------------- ----------
40497881-5a89-4c39-b3f7-5d22db2fee51 N/A                 2013-03-20T09:44:25      213581824          0
=============


Some info:

Not only permissions, some keystone parameters are also missing:
=============
$ sudo chmod -R a+r /usr/share/glance
=============
$ sudo ls -al /etc/glance/glance-cache.conf /usr/share/glance/glance-cache-dist.conf
-rw-r--r--. 1 root glance 605 Mar 20 15:14 /etc/glance/glance-cache.conf
-rw-r--r--. 1 root glance 116 Mar 14 05:16 /usr/share/glance/glance-cache-dist.conf
=============


New glance-cache.conf with updated keystone parameters:
=============
$ sudo cat /etc/glance/glance-cache.conf 
[DEFAULT]
verbose = True
debug = True
log_file = /var/log/glance/image-cache.log
image_cache_max_size = 10737418240
registry_host = 0.0.0.0
registry_port = 9191


auth_url = http://127.0.0.1:35357/v2.0/
admin_tenant_name = admin
admin_user = admin
admin_password = secret

[app:glance-pruner]
paste.app_factory = glance.image_cache.pruner:app_factory
[app:glance-prefetcher]
paste.app_factory = glance.image_cache.prefetcher:app_factory
[app:glance-cleaner]
paste.app_factory = glance.image_cache.cleaner:app_factory
[app:glance-queue-image]
paste.app_factory = glance.image_cache.queue_image:app_factory
=============

Comment 24 errata-xmlrpc 2013-03-21 19:04:35 UTC
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


Note You need to log in before you can comment on or make changes to this bug.