nova list ignores --tenant argument
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Roman Podoliaka | ||
python-novaclient |
Fix Released
|
Undecided
|
Roman Podoliaka |
Bug Description
It came to my attention that when trying to list the instances of an specific tenant, the --tenant argument provided for the list function is ignored.
The default tenant for this action is OS_TENANT_NAME.
Steps to reproduce:
1. Create one or more instances in different tenants, e.g. demo and demo2
2. Use nova list with --tenant argument initiated with demo's tenant id
3. Use nova list with --tenant argument initiated with demo2's tenant id
4. Check that the output is the same for 2. and 3.
Expected result: Instance list for each tenant
Actual result:
Tenant: demo - Instances: Cirros1.1 and Cirros1.2
Tenant: demo2 - Instances: Cirros2.1 and Cirros 2.2
OS_TENANT_NAME = demo
[vkmc@thermalx2 ~]$ keystone tenant-list
+------
| id | name | enabled |
+------
| 96776baee20e49c
| fa7880aa16d349f
| e449b529f202419
| 186b554e5b344cc
| 9d862590f7ec4d0
| 6e1525e829754ef
+------
[vkmc@thermalx2 ~]$ nova list --all-tenants 1
+------
| ID | Name | Status | Networks |
+------
| 4f3e08b5-
| e74a88c5-
| 5c9c77f8-
| 2c6ad73b-
+------
[vkmc@thermalx2 ~]$ nova list --tenant e449b529f202419
+------
| ID | Name | Status | Networks |
+------
| 4f3e08b5-
| e74a88c5-
+------
[vkmc@thermalx2 ~]$ nova list --tenant 186b554e5b344cc
+------
| ID | Name | Status | Networks |
+------
| 4f3e08b5-
| e74a88c5-
+------
description: | updated |
Changed in python-novaclient: | |
assignee: | nobody → Roman Podolyaka (rpodolyaka) |
Changed in nova: | |
assignee: | nobody → Roman Podolyaka (rpodolyaka) |
Changed in python-novaclient: | |
status: | New → In Progress |
Changed in python-novaclient: | |
status: | Fix Committed → Fix Released |
I've been investigating this bug for a few hours and have found this:
1. --tenant argument is not ignored, novaclient actually does following HTTP query to Nova API: 842f0b2363acc8d 7cd41b/ servers/ detail? project_ id=5bafd111e970 40d28f48e51f774 c5a6f HTTP/1.1
GET /v2/43a00152945
(where 43a00152945842f 0b2363acc8d7cd4 1b is an admin tenant id, 5bafd111e97040d 28f48e51f774c5a 6f is a tenant id)
2. Compute API v2 spec (http:// docs.openstack. org/api/ openstack- compute/ 2/content/ List_Servers- d1e2078. html) for endpoint /{tenant_ id}/servers/ detail doesn't seem to provide the "project_id" filter used by novaclient.
GET /{version}
3. Nova code doesn't seem to provide filtering of instances by project_id (nova/nova/ api/openstack/ compute. py Controller. _get_servers( )).
Filtering by tenant was added to novaclient by this patch https:/ /review. openstack. org/#/c/ 16318/2. From what I see the corresponding Nova feature has never been implemented. So I attach Nova as a project affected by this bug.