Bug 1653755

Summary: Cinder quota vs openstack quota dare you mix them together
Product: Red Hat OpenStack Reporter: Tzach Shefi <tshefi>
Component: python-openstackclientAssignee: Julie Pichon <jpichon>
Status: CLOSED DUPLICATE QA Contact: nlevinki <nlevinki>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14.0 (Rocky)CC: abishop, apevec, jpichon, lhh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-28 13:49:42 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:

Description Tzach Shefi 2018-11-27 15:12:49 UTC
Description of problem: Again an inconsistency this time between Cinder api vs openstack unified client. Setting/showing Cinder volume quota is looks broken.

Version-Release number of selected component (if applicable):
python-openstackclient-lang-3.16.1-0.20180925042058.3e5a2d2.el7ost.noarch
openstack-cinder-13.0.1-0.20181013185427.31ff628.el7ost.noarch
python2-cinderclient-4.0.1-0.20180809133302.460229c.el7ost.noarch
python-cinder-13.0.1-0.20181013185427.31ff628.el7ost.noarch
puppet-cinder-13.3.1-0.20181013114721.25b1ba3.el7ost.noarch


How reproducible:
Every time 


Steps to Reproduce:
1. with cinder API things look fine, default quota:
cinder quota-usage admin
+----------------------+--------+----------+-------+-----------+
| Type                 | In_use | Reserved | Limit | Allocated |
+----------------------+--------+----------+-------+-----------+
| backup_gigabytes     | 0      | 0        | 1000  |           |
| backups              | 0      | 0        | 10    |           |
| gigabytes            | 0      | 0        | 1000  |           |
| gigabytes_tripleo    | 0      | 0        | -1    |           |
| groups               | 0      | 0        | 10    |           |
| per_volume_gigabytes | 0      | 0        | -1    |           |
| snapshots            | 0      | 0        | 10    |           |
| snapshots_tripleo    | 0      | 0        | -1    |           |
| volumes              | 0      | 0        | 10    |           |
| volumes_tripleo      | 0      | 0        | -1    |           |
+----------------------+--------+----------+-------+-----------+


2. Now use openstack quota-show 
openstack quota show admin                                                                                                                                                                               
+----------------------+----------------------------------+                                                                                                                                                                                  
| Field                | Value                            |                                                                                                                                                                                  
+----------------------+----------------------------------+                                                                                                                                                                                  
| backup-gigabytes     | 1000                             |                                                                                                                                                                                  
| backups              | 10                               |                                                                                                                                                                                  
| cores                | 20                               |                                                                                                                                                                                  
| fixed-ips            | -1                               |                                                                                                                                                                                  
| floating-ips         | 50                               |                                                                                                                                                                                  
| gigabytes            | 1000                             |                                                                                                                                                                                  
| gigabytes_tripleo    | -1                               |                                                                                                                                                                                  
| groups               | 10                               |                                                                                                                                                                                  
| health_monitors      | None                             |                                                                                                                                                                                  
| injected-file-size   | 10240                            |                                                                                                                                                                                  
| injected-files       | 5                                |                                                                                                                                                                                  
| injected-path-size   | 255                              |                                                                                                                                                                                  
| instances            | 10                               |                                                                                                                                                                                  
| key-pairs            | 100                              |
| l7_policies          | None                             |
| listeners            | None                             |
| load_balancers       | None                             |
| location             | None                             |
| name                 | None                             |
| networks             | 100                              |
| per-volume-gigabytes | -1                               |
| pools                | None                             |
| ports                | 500                              |
| project              | 044d9cd9518a482fbcd9789df324eaf2 |
| project_name         | admin                            |
| properties           | 128                              |
| ram                  | 51200                            |
| rbac_policies        | 10                               |
| routers              | 10                               |
| secgroup-rules       | 100                              |
| secgroups            | 10                               |
| server-group-members | 10                               |
| server-groups        | 10                               |
| snapshots            | 10                               |
| snapshots_tripleo    | -1                               |
| subnet_pools         | -1                               |
| subnets              | 100                              |
| volumes              | 10                               |
| volumes_tripleo      | -1                               |
+----------------------+----------------------------------+

Also looking fine, I'm focusing on volumes field. 

3. Now lets update via openstack client

$  openstack quota set --volumes 30 admin
$ openstack quota show admin
+----------------------+----------------------------------+
| Field                | Value                            |
+----------------------+----------------------------------+
| backup-gigabytes     | 1000                             |
| backups              | 10                               |
| cores                | 20                               |
| fixed-ips            | -1                               |
| floating-ips         | 50                               |
| gigabytes            | 1000                             |
| gigabytes_tripleo    | -1                               |
| groups               | 10                               |
| health_monitors      | None                             |
| injected-file-size   | 10240                            |
| injected-files       | 5                                |
| injected-path-size   | 255                              |
| instances            | 10                               |
| key-pairs            | 100                              |
| l7_policies          | None                             |
| listeners            | None                             |
| load_balancers       | None                             |
| location             | None                             |
| name                 | None                             |
| networks             | 100                              |
| per-volume-gigabytes | -1                               |
| pools                | None                             |
| ports                | 500                              |
| project              | 044d9cd9518a482fbcd9789df324eaf2 |
| project_name         | admin                            |
| properties           | 128                              |
| ram                  | 51200                            |
| rbac_policies        | 10                               |
| routers              | 10                               |
| secgroup-rules       | 100                              |
| secgroups            | 10                               |
| server-group-members | 10                               |
| server-groups        | 10                               |
| snapshots            | 10                               |
| snapshots_tripleo    | -1                               |
| subnet_pools         | -1                               |
| subnets              | 100                              |
| volumes              | 30                               |
| volumes_tripleo      | -1                               |
+----------------------+----------------------------------+

Still looking great, you'ed think..

$ cinder quota-usage admin
+----------------------+--------+----------+-------+-----------+
| Type                 | In_use | Reserved | Limit | Allocated |
+----------------------+--------+----------+-------+-----------+
| backup_gigabytes     | 0      | 0        | 1000  |           |
| backups              | 0      | 0        | 10    |           |
| gigabytes            | 0      | 0        | 1000  |           |
| gigabytes_tripleo    | 0      | 0        | -1    |           |
| groups               | 0      | 0        | 10    |           |
| per_volume_gigabytes | 0      | 0        | -1    |           |
| snapshots            | 0      | 0        | 10    |           |
| snapshots_tripleo    | 0      | 0        | -1    |           |
| volumes              | 0      | 0        | 10    |           |
| volumes_tripleo      | 0      | 0        | -1    |           |
+----------------------+--------+----------+-------+-----------+

See above volumes remains 10, shouldn't it be 30 ? 
Now I'm confused where was the 30 value stored used?


4. Now the fun part, where I suspect we could cause real problems.
$ openstack project list
+----------------------------------+---------+
| ID                               | Name    |
+----------------------------------+---------+
| 044d9cd9518a482fbcd9789df324eaf2 | admin   |
| 7dc4568e5c21452dbfbe7c983a152b0d | service |
+----------------------------------+---------+
$ cinder quota-update 044d9cd9518a482fbcd9789df324eaf2  --volumes 20
+----------------------+-------+
| Property             | Value |
+----------------------+-------+
| backup_gigabytes     | 1000  |
| backups              | 10    |
| gigabytes            | 1000  |
| gigabytes_tripleo    | -1    |
| groups               | 10    |
| per_volume_gigabytes | -1    |
| snapshots            | 10    |
| snapshots_tripleo    | -1    |
| volumes              | 20    |
| volumes_tripleo      | -1    |
+----------------------+-------+

Sweet Cinder Api works as expected, updates right away. 
But then again where is openstack unified client quota update's 30 value?
Will it popup later only to bight our head off? 

Don't know who needs to fix this.
Don't know how this should be fixed.
I'm just reporting a problem, would one user update via Cinder CLI, and another user check via Openstack client. 

Expected results:
Expect values in this case volumes should report consistent value no mater which client was used to update/show them. 

Additional info:

Comment 1 Julie Pichon 2018-11-27 16:16:51 UTC
Moving to DFG:Storage for Cinder-related commands. You may want to include the logs when running the commands with --debug to get more information. Thank you.

Comment 2 Alan Bishop 2018-11-28 13:49:42 UTC
The root cause is the cinder CLI's quota-show and quota-update commands do not properly handle project names. When comparing the openstack and cinder CLI outputs, you will find they are consistent as long as you only specify (valid) project ID (not name) for the cinder CLI.

So, in step 3, if you ran "cinder quota-usage 044d9cd9518a482fbcd9789df324eaf2" you should see it reporting 30 for the volumes field.

I'm confused by your comment in step 4. You used "cinder quota-update" (specifying the project ID, which is correct usage) to change volumes to 20. You wonder, "where is openstack unified client quota update's 30 value" and the answer is you just overwrote the value using the cinder command.

We're tracking this using using bug #1574431.

*** This bug has been marked as a duplicate of bug 1574431 ***