openstack limits show --absolute --project <project id> does not work correctly for volumes and security groups

Bug #1857320 reported by Shatadru Bandyopadhyay
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-openstackclient (Ubuntu)
Undecided
Unassigned

Bug Description

openstack limits show --absolute --project <project id> does not work correctly for volumes and security groups
--------------------

if I source admin credential even if I use `openstack limits show --absolute --project <project id> ` it shows details for admin project for volumes and security groups.

OS_REGION_NAME=regionOne
OS_USER_DOMAIN_NAME=Default
OS_IMAGE_API_VERSION=2
OS_PROJECT_NAME=admin
OS_IDENTITY_API_VERSION=3
OS_PASSWORD=xxxx
OS_AUTH_TYPE=password
PS1=${OS_CLOUDNAME:+($OS_CLOUDNAME)} [\u@\h \W]\$
OS_AUTH_URL=http://192.168.100.7:5000//v3
OS_USERNAME=admin
OS_VOLUME_API_VERSION=3
OS_NO_CACHE=True
OS_CLOUDNAME=overcloud
OS_PROJECT_DOMAIN_NAME=Default

admin limits :
openstack limits show --absolute
None
+--------------------------+-------+
| Name | Value |
+--------------------------+-------+
| maxServerMeta | 128 |
| maxTotalInstances | 10 |
| maxPersonality | 5 |
| totalServerGroupsUsed | 0 |
| maxImageMeta | 128 |
| maxPersonalitySize | 10240 |
| maxTotalRAMSize | 51200 |
| maxServerGroups | 10 |
| maxSecurityGroupRules | 20 |
| maxTotalKeypairs | 100 |
| totalCoresUsed | 4 |
| totalRAMUsed | 4096 |
| maxSecurityGroups | 10 |
| totalFloatingIpsUsed | 0 |
| totalInstancesUsed | 2 |
| maxServerGroupMembers | 10 |
| maxTotalFloatingIps | 10 |
| totalSecurityGroupsUsed | 1 |
| maxTotalCores | 20 |
| totalSnapshotsUsed | 0 |
| maxTotalBackups | 10 |
| maxTotalVolumeGigabytes | 1000 |
| maxTotalSnapshots | 10 |
| maxTotalBackupGigabytes | 1000 |
| totalBackupGigabytesUsed | 0 |
| maxTotalVolumes | 10 |
| totalVolumesUsed | 3 |
| totalBackupsUsed | 0 |
| totalGigabytesUsed | 3 |
+--------------------------+-------+

test project limits :

(overcloud-test-project) [stack@shatadru-osp13-director ~]$ source test-user.rc
(overcloud-test-project) [stack@shatadru-osp13-director ~]$ env|grep -i OS_
OS_REGION_NAME=regionOne
OS_USER_DOMAIN_NAME=Default
OS_IMAGE_API_VERSION=2
OS_PROJECT_NAME=test-project
OS_IDENTITY_API_VERSION=3
OS_PASSWORD=xxxxxx
OS_AUTH_TYPE=password
PS1=${OS_CLOUDNAME:+($OS_CLOUDNAME)} [\u@\h \W]\$
OS_AUTH_URL=http://192.168.100.7:5000//v3
OS_USERNAME=test-user
OS_VOLUME_API_VERSION=3
OS_NO_CACHE=True
OS_CLOUDNAME=overcloud-test-project
OS_PROJECT_DOMAIN_NAME=Default

This works too :
(overcloud-test-project) [stack@shatadru-osp13-director ~]$ openstack limits show --absolute
None
+--------------------------+-------+
| Name | Value |
+--------------------------+-------+
| maxServerMeta | 128 |
| maxTotalInstances | 10 |
| maxPersonality | 5 |
| totalServerGroupsUsed | 0 |
| maxImageMeta | 128 |
| maxPersonalitySize | 10240 |
| maxTotalRAMSize | 51200 |
| maxServerGroups | 10 |
| maxSecurityGroupRules | 20 |
| maxTotalKeypairs | 100 |
| totalCoresUsed | 2 |
| totalRAMUsed | 2048 |
| maxSecurityGroups | 10 |
| totalFloatingIpsUsed | 0 |
| totalInstancesUsed | 1 |
| maxServerGroupMembers | 10 |
| maxTotalFloatingIps | 10 |
| totalSecurityGroupsUsed | 1 | <--
| maxTotalCores | 20 |
| totalSnapshotsUsed | 0 |
| maxTotalBackups | 10 |
| maxTotalVolumeGigabytes | 1000 |
| maxTotalSnapshots | 10 |
| maxTotalBackupGigabytes | 1000 |
| totalBackupGigabytesUsed | 0 |
| maxTotalVolumes | 10 |
| totalVolumesUsed | 1 | <-- for this project(test-project) this is correct
| totalBackupsUsed | 0 |
| totalGigabytesUsed | 1 |
+--------------------------+-------+

But if I source admin credential and try to list details for specific project the details are incorrect
~~~
openstack limits show --project 2f50689300a948ba912988a65f8a42f1 --absolute
+--------------------------+-------+
| Name | Value |
+--------------------------+-------+
| maxServerMeta | 128 |
| maxTotalInstances | 10 |
| maxPersonality | 5 |
| totalServerGroupsUsed | 0 |
| maxImageMeta | 128 |
| maxPersonalitySize | 10240 |
| maxTotalRAMSize | 51200 |
| maxServerGroups | 10 |
| maxSecurityGroupRules | 20 |
| maxTotalKeypairs | 100 |
| totalCoresUsed | 4 |
| totalRAMUsed | 4096 |
| maxSecurityGroups | 10 |
| totalFloatingIpsUsed | 0 |
| totalInstancesUsed | 2 |
| maxServerGroupMembers | 10 |
| maxTotalFloatingIps | 10 |
| totalSecurityGroupsUsed | 1 |
| maxTotalCores | 20 |
| totalSnapshotsUsed | 0 |
| maxTotalBackups | 10 |
| maxTotalVolumeGigabytes | 1000 |
| maxTotalSnapshots | 10 |
| maxTotalBackupGigabytes | 1000 |
| totalBackupGigabytesUsed | 0 |
| maxTotalVolumes | 10 |
| totalVolumesUsed | 3 | < --- this is not for test-project but for admin
| totalBackupsUsed | 0 |
| totalGigabytesUsed | 3 |
+--------------------------+-------+

~~~

#source overcloud

openstack project list
+----------------------------------+--------------+
| ID | Name |
+----------------------------------+--------------+
| 046e24ef0bb844609aeb14f21c8d2af0 | service |
| 2f50689300a948ba912988a65f8a42f1 | test-project |
| 34fb06df15fe46d3b52bc17a7af07e42 | admin |
+----------------------------------+--------------+

If we use --debug, we can see openstackclient is sending api call to get admin project details (http://192.168.100.7:8776/v3/34fb06df15fe46d3b52bc17a7af07e42)instead of the one we passed in command line(2f50689300a948ba912988a65f8a42f1)

~~~
REQ: curl -g -i -X GET http://192.168.100.7:8776/v3/34fb06df15fe46d3b52bc17a7af07e42/limits -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}aac11b336cb6ac9d71bd8cb7a0486f3693833ea1"
Starting new HTTP connection (1): 192.168.100.7
http://192.168.100.7:8776 "GET /v3/34fb06df15fe46d3b52bc17a7af07e42/limits HTTP/1.1" 200 148
RESP: [200] Date: Mon, 23 Dec 2019 07:23:38 GMT Server: Apache x-compute-request-id: req-d895762f-ebeb-4ea4-97e2-9b3dcf65e370 OpenStack-API-Version: volume 3.0 Vary: OpenStack-API-Version,Accept-Encoding x-openstack-request-id: req-d895762f-ebeb-4ea4-97e2-9b3dcf65e370 Content-Encoding: gzip Content-Length: 148 Content-Type: application/json
RESP BODY: {"limits": {"rate": [], "absolute": {"totalSnapshotsUsed": 0, "maxTotalBackups": 10, "maxTotalVolumeGigabytes": 1000, "maxTotalSnapshots": 10, "maxTotalBackupGigabytes": 1000, "totalBackupGigabytesUsed": 0, "maxTotalVolumes": 10, "totalVolumesUsed": 3, "totalBackupsUsed": 0, "totalGigabytesUsed": 3}}}
~~~

if we source that project's credential, it sends correct api call 'http://192.168.100.7:8776/v3/2f50689300a948ba912988a65f8a42f1/limits'

~~~
GET call to compute for http://192.168.100.7:8774/v2.1/limits used request id req-3c7c0118-6873-4c27-bd42-990a247f466d
REQ: curl -g -i -X GET http://192.168.100.7:8776/v3/2f50689300a948ba912988a65f8a42f1/limits -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}163d2047ed15afcda3c0cbe37c86b87ea54ad6bb"
Starting new HTTP connection (1): 192.168.100.7
http://192.168.100.7:8776 "GET /v3/2f50689300a948ba912988a65f8a42f1/limits HTTP/1.1" 200 148
RESP: [200] Date: Mon, 23 Dec 2019 07:27:53 GMT Server: Apache x-compute-request-id: req-9f93863c-9d43-4d4b-acb7-be8337382abd OpenStack-API-Version: volume 3.0 Vary: OpenStack-API-Version,Accept-Encoding x-openstack-request-id: req-9f93863c-9d43-4d4b-acb7-be8337382abd Content-Encoding: gzip Content-Length: 148 Content-Type: application/json
RESP BODY: {"limits": {"rate": [], "absolute": {"totalSnapshotsUsed": 0, "maxTotalBackups": 10, "maxTotalVolumeGigabytes": 1000, "maxTotalSnapshots": 10, "maxTotalBackupGigabytes": 1000, "totalBackupGigabytesUsed": 0, "maxTotalVolumes": 10, "totalVolumesUsed": 1, "totalBackupsUsed": 0, "totalGigabytesUsed": 1}}}
~~~

 68 def take_action(self, parsed_args):
 69 #pdb.set_trace()
 70
 71 compute_client = self.app.client_manager.compute
 72 volume_client = self.app.client_manager.volume
 73
 74 project_id = None
 75 if parsed_args.project is not None:
 76 identity_client = self.app.client_manager.identity
 77 if parsed_args.domain is not None:
 78 domain = identity_common.find_domain(identity_client,
 79 parsed_args.domain)
 80 project_id = utils.find_resource(identity_client.projects,
 81 parsed_args.project,
 82 domain_id=domain.id).id
 83 else:
 84 project_id = utils.find_resource(identity_client.projects,
 85 parsed_args.project).id
 86 #print (project_id)
 87
 88 compute_limits = compute_client.limits.get(parsed_args.is_reserved,
 89 tenant_id=project_id)
 90 volume_limits = volume_client.limits.get() <---

Revision history for this message
Shatadru Bandyopadhyay (shatadru) wrote :

The totalGigabytesUsed issue was already reported :

https://bugs.launchpad.net/ubuntu/+source/python-openstackclient/+bug/1792880

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-openstackclient (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers