Listing SOFT_DELETED servers by vm_state does not work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
In Progress
|
Undecided
|
Fan Zhang |
Bug Description
Description
===========
In nova api reference [1], we know that we can list instances by status or vm_state, note that vm_state should work for admin only. But actually, listing instances by vm_state does not work as excepted in queens 17.0.3. I checked the master branch, it should have the same issue.
I added some logs and did the following tests:
* searching by status:
curl -g -i -X GET http://<url>:<
the logs:
Searching by: {'deleted': False, 'vm_state': ['soft-delete'], 'project_id': u'ddc5e1deb69b4
Filters are {'deleted': False, 'vm_state': ['soft-delete'], 'project_id': u'ddc5e1deb69b4
* searching by vm_state:
curl -g -i -X GET http://<url>:<
the logs:
Searching by: {'deleted': False, u'vm_state': u'SOFT_DELETED', 'project_id': u'ddc5e1deb69b4
Filters are {'deleted': False, u'vm_state': u'SOFT_DELETED', 'project_id': u'ddc5e1deb69b4
As you can see, nova does not process search option 'vm_state' the same way as search option 'status'. And we'll get no servers matched.
[root@hb02-
+------
| Field | Value |
+------
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-
| OS-EXT-
| OS-EXT-
| OS-EXT-
| OS-EXT-
| OS-EXT-
| OS-EXT-STS:vm_state | soft-delete |
| OS-SRV-
| OS-SRV-
| accessIPv4 | |
| accessIPv6 | |
| addresses | elbarco-
| config_drive | True |
| created | 2019-12-
| flavor | 1c1g (9556168e-
| hostId | 547e90398648cb4
| id | 19dbdabe-
| image | CentOS7.5 (7e8d8df8-
| key_name | None |
| name | elbarco-1 |
| project_id | 001a18cadd4b401
| properties | |
| security_groups | id='4abfcbbe-
| status | SOFT_DELETED |
| updated | 2019-12-
| user_id | 8f3e215075c54a9
| volumes_attached | |
+------
[root@hb02-
HTTP/1.1 200 OK
X-Openstack-
X-Compute-
X-Openstack-
Vary: X-OpenStack-
Openstack-
Date: Tue, 24 Dec 2019 14:55:12 GMT
Content-Type: application/json
content-length: 15
{"servers": []}
Related bug: https:/
References
==========
Changed in nova: | |
assignee: | nobody → Fan Zhang (fanzhang) |
description: | updated |
description: | updated |
description: | updated |
summary: |
- Listing servers by vm_state does not work + Listing SOFT_DELETED servers by vm_state does not work |
Fix proposed to branch: master /review. opendev. org/700520
Review: https:/