Bug 1396794

Summary: Glance-manage db purge not remove rows that was created less then one day
Product: Red Hat OpenStack Reporter: Avi Avraham <aavraham>
Component: openstack-glanceAssignee: Cyril Roelandt <cyril>
Status: CLOSED ERRATA QA Contact: Avi Avraham <aavraham>
Severity: unspecified Docs Contact:
Priority: low    
Version: 10.0 (Newton)CC: aavraham, acanan, cschwede, cyril, dhill, eglynn, fpercoco, mlopes, nlevinki, sclewis, scohen, srevivo
Target Milestone: Upstream M3Keywords: FutureFeature, Triaged
Target Release: 11.0 (Ocata)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-glance-14.0.0-0.20170106023234.922a2d7.el7ost Doc Type: Enhancement
Doc Text:
With this enhancement, `glance-manage db purge` can now remove rows that are less than one day old. This was added because operators may need to run this operation on a regular basis. As a result, the value of the `age_in_days` option can be set to `0`.
Story Points: ---
Clone Of:
: 1412622 (view as bug list) Environment:
Last Closed: 2017-05-17 19:47:28 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:
Bug Depends On: 1416494    
Bug Blocks: 1412622    

Description Avi Avraham 2016-11-20 09:49:16 UTC
Description of problem:
The value of glance-manage db purge --age_in_days can not be 0.
A request for Adding an option --age_in_days=0 will allow to remove rows from db of deleted images that took place less then 1 day ago, The motivation to add this ability will allow testing db purge other functionalities.

Version-Release number of selected component (if applicable):

python-glance-tests-13.0.0-1.el7ost.noarch
python-glanceclient-2.5.0-1.el7ost.noarch
python-glance-store-0.18.1-0.20161003180701.4e144bb.el7ost.noarch
openstack-glance-13.0.0-1.el7ost.noarch


How reproducible:


Steps to Reproduce:
glance-manage db purge --age_in_days 0

Comment 2 Christian Schwede (cschwede) 2016-12-21 09:52:40 UTC
Upstream patch merged, moving to POST

Comment 8 Avi Avraham 2017-03-16 11:53:36 UTC
The following command is failed to run on overcloud and undercloud
glance-manage db <Any sub command>
due to configuration file permission denied error 

Option "verbose" from group "DEFAULT" is deprecated for removal.  Its value may be silently ignored in the future.
Traceback (most recent call last):
  File "/bin/glance-manage", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/glance/cmd/manage.py", line 439, in main
    config.parse_args(default_config_files=cfg_files)
  File "/usr/lib/python2.7/site-packages/glance/common/config.py", line 680, in parse_args
    default_config_files=default_config_files)
  File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2359, in __call__
    self._namespace._files_permission_denied)
oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some config files: /etc/glance/glance-registry.conf,/etc/glance/glance-api.conf

python-glance-14.0.1-0.20170222152138.13f96bf.el7ost.noarch
puppet-glance-10.3.0-0.20170220180438.4ec5c5c.el7ost.noarch
python-glanceclient-2.6.0-0.20170208132836.9afb56c.el7ost.noarch
python-glance-store-0.20.1-0.20170210090113.3646e91.el7ost.noarch
openstack-glance-14.0.1-0.20170222152138.13f96bf.el7ost.noarch

Comment 9 Christian Schwede (cschwede) 2017-03-16 12:19:00 UTC
@Avi: did you also test with a different user (ie root or using sudo)?

On the overcloud this might be related to the fact that the default "heat-admin" user is not allowed to read the Glance config files because they are owned by the glance user. Same for the undercloud and the stack user.

Can you please retry with "sudo glance-manage db ..."?

Comment 10 Avi Avraham 2017-03-16 12:43:13 UTC
(In reply to Christian Schwede (cschwede) from comment #9)
> @Avi: did you also test with a different user (ie root or using sudo)?
> 
> On the overcloud this might be related to the fact that the default
> "heat-admin" user is not allowed to read the Glance config files because
> they are owned by the glance user. Same for the undercloud and the stack
> user.
> 
> Can you please retry with "sudo glance-manage db ..."?

[stack@undercloud-0 ~]$ . overcloudrc 
[stack@undercloud-0 ~]$ sudo glance-manage db version 
Option "verbose" from group "DEFAULT" is deprecated for removal.  Its value may be silently ignored in the future.
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1241: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
  expire_on_commit=expire_on_commit, _conf=conf)
BTW there is a separate bug for this issue that I opened few weeks ago 
https://bugzilla.redhat.com/show_bug.cgi?id=1416494

Comment 12 errata-xmlrpc 2017-05-17 19:47:28 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.

https://access.redhat.com/errata/RHEA-2017:1245