Bug 1600399 - Project purge deletes ALL images
Summary: Project purge deletes ALL images
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-openstackclient
Version: 12.0 (Pike)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: z3
: 12.0 (Pike)
Assignee: Julie Pichon
QA Contact: Shai Revivo
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-12 07:46 UTC by Sandeep Yadav
Modified: 2022-08-09 09:22 UTC (History)
4 users (show)

Fixed In Version: python-openstackclient-3.12.1-1.el7ost
Doc Type: Bug Fix
Doc Text:
Prior to this update, the "project purge" command deleted all images regardless of which project owned it. This update fixes a mismatch between deletion code for Glance V1 and V2. It adds code specific to Glance V2 to handle the deletion correctly. Now the "project purge" command only deletes images owned by the specified project ID when run by an admin user.
Clone Of:
Environment:
Last Closed: 2018-08-20 12:54:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1717130 0 None None None 2018-07-12 07:48:24 UTC
OpenStack gerrit 517369 0 None None None 2018-07-12 08:25:20 UTC
Red Hat Issue Tracker OSP-9299 0 None None None 2022-08-09 09:22:16 UTC
Red Hat Product Errata RHBA-2018:2521 0 None None None 2018-08-20 12:54:34 UTC

Description Sandeep Yadav 2018-07-12 07:46:41 UTC
Description of problem:

"openstack project purge --project projectName" command began to delete all images, including ones the project did not own.

This issue is reported in upstream bugzilla:-

~~~
https://bugs.launchpad.net/python-openstackclient/+bug/1717130
~~~

As per the Upstream bug, This issue was fixed in the openstack/python-openstackclient 3.13.0 release.

I found till OSP 12, we are still shipping python-openstackclient-3.12.0-1.el7ost.noarch.rpm 

~~~
https://access.redhat.com/downloads/content/rhel---7/x86_64/5904/python-openstackclient/3.12.0-1.el7ost/noarch/fd431d51/package
~~~

From OSP 13, We are shipping python-openstackclient-3.14.1-1.el7ost.src.rpm , Where issue is resolved:-

~~~
https://access.redhat.com/downloads/content/rhel---7/x86_64/6671/python2-openstackclient/3.14.1-1.el7ost/noarch/fd431d51/package
~~~


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


How reproducible: Everytime


Steps to Reproduce:

======

In prior OSP version, before OSP 12

Purge command began to delete all images, including ones the project did not own.

[stack@undercloud-0 ~]$ openstack role add --project new_test_project --user test admin
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | 31450a154ae24d8bb34b4077320f293b |
| name      | admin                            |
+-----------+----------------------------------+

I created a private image in admin project:-

[stack@undercloud-0 ~]$ . overcloudrc 
[stack@undercloud-0 ~]$ openstack image list --long
+--------------------------------------+--------+-------------+------------------+----------+----------------------------------+--------+------------+-----------+----------------------------------+------+
| ID                                   | Name   | Disk Format | Container Format |     Size | Checksum                         | Status | Visibility | Protected | Project                          | Tags |
+--------------------------------------+--------+-------------+------------------+----------+----------------------------------+--------+------------+-----------+----------------------------------+------+
| 5e547efd-4de2-4869-b6b7-16314fe9b9f0 | cirros | qcow2       | bare             | 13287936 | ee1eca47dc88f4879d8a229cc70a07c6 | active | private    | False     | 125870e89d8e42bc89900e87eb9a08a3 |      |
+--------------------------------------+--------+-------------+------------------+----------+----------------------------------+--------+------------+-----------+----------------------------------+------+

[stack@undercloud-0 ~]$ . testrc 
[stack@undercloud-0 ~]$ openstack image list --long
+--------------------------------------+--------+-------------+------------------+----------+----------------------------------+--------+------------+-----------+----------------------------------+------+
| ID                                   | Name   | Disk Format | Container Format |     Size | Checksum                         | Status | Visibility | Protected | Project                          | Tags |
+--------------------------------------+--------+-------------+------------------+----------+----------------------------------+--------+------------+-----------+----------------------------------+------+
| 5e547efd-4de2-4869-b6b7-16314fe9b9f0 | cirros | qcow2       | bare             | 13287936 | ee1eca47dc88f4879d8a229cc70a07c6 | active | private    | False     | 125870e89d8e42bc89900e87eb9a08a3 |      |
+--------------------------------------+--------+-------------+------------------+----------+----------------------------------+--------+------------+-----------+----------------------------------+------+

[stack@undercloud-0 ~]$ openstack project list
+----------------------------------+-------------------+
| ID                               | Name              |
+----------------------------------+-------------------+
| 125870e89d8e42bc89900e87eb9a08a3 | admin             |
| 6289a548a9e64daa885da90eba5eb688 | service           |
| 92b23854a8b84735aca7b16760a512dc | new_test_project  |
| 9d4062946f6e45ce9b2833616b396c17 | new_test_project2 |
+----------------------------------+-------------------+

[stack@undercloud-0 ~]$ openstack project purge --project 92b23854a8b84735aca7b16760a512dc
Deleting image : 5e547efd-4de2-4869-b6b7-16314fe9b9f0  -------> Image cirros got deleted, But this image was not owned by "new_test_project" project.
Deleting project: 92b23854a8b84735aca7b16760a512dc


[stack@undercloud-0 ~]$ rpm -qa | grep -i openstackclient
python-openstackclient-3.12.0-1.el7ost.noarch
python-openstackclient-lang-3.12.0-1.el7ost.noarch


In Latest OSP 13:- Issue is solved only particular images got purged which is owned by project.
=================

(overcloud) [stack@undercloud-0 ~]$ openstack image list
+--------------------------------------+---------------------------------+--------+
| ID                                   | Name                            | Status |
+--------------------------------------+---------------------------------+--------+
| fefadf1d-cfac-4afd-a48c-5820335a780c | cirros                          | active |
| 2954c877-491d-4ad9-b29b-078f4378bc38 | cirros_sandy                    | active |
| 30548ea2-a01a-4d14-b195-3e93a4cfeee5 | octavia-amphora-13.0-20180703.1 | active |
+--------------------------------------+---------------------------------+--------+
(overcloud) [stack@undercloud-0 ~]$ openstack project list
+----------------------------------+--------------+
| ID                               | Name         |
+----------------------------------+--------------+
| 317086217930443faa6530517bf52452 | service      |
| 4b398d7bdc224533bfcadb0d8546bb76 | test_project |
| e18484fae08a42ee99d7b89a4b10ee1b | admin        |
| f661ba5aa600491088ce3655e2b5b8da | sandy        |
+----------------------------------+--------------+

(overcloud) [stack@undercloud-0 ~]$ . sandy 
(overcloud) [stack@undercloud-0 ~]$ openstack project purge --project f661ba5aa600491088ce3655e2b5b8da
Deleting image : 2954c877-491d-4ad9-b29b-078f4378bc38
Deleting project: f661ba5aa600491088ce3655e2b5b8da

(overcloud) [stack@undercloud-0 ~]$ . overcloudrc 
(overcloud) [stack@undercloud-0 ~]$ openstack image list
+--------------------------------------+---------------------------------+--------+
| ID                                   | Name                            | Status |
+--------------------------------------+---------------------------------+--------+
| fefadf1d-cfac-4afd-a48c-5820335a780c | cirros                          | active |
| 30548ea2-a01a-4d14-b195-3e93a4cfeee5 | octavia-amphora-13.0-20180703.1 | active |
+--------------------------------------+---------------------------------+--------+
(overcloud) [stack@undercloud-0 ~]$ rpm -qa | grep -i openstackclient
python-openstackclient-lang-3.14.1-1.el7ost.noarch
python2-openstackclient-3.14.1-1.el7ost.noarch

Actual results:

This command began to delete All images, including ones the project did not own.

Expected results:

Only Images which are part of intended project should be deleted.


Additional info:

Comment 2 Julie Pichon 2018-07-12 08:25:21 UTC
Thank you for the detailed bug report. Unfortunately 3.13 is a Queens/OSP13 release ( https://releases.openstack.org/teams/openstackclient.html#team-queens-python-openstackclient ) and can't be included in OSP12. However it looks like this particular patch was already backported to Pike and is included in the next point release, 3.12.1. I can see the package for this is already built downstream and would expect it to be included in the next OSP12 maintenance release.

Comment 5 errata-xmlrpc 2018-08-20 12:54: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/RHBA-2018:2521


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