nova list --fields fails if no VMs are running

Bug #1624978 reported by Paul
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Undecided
Diana Clarke

Bug Description

The fix for bug #1522989 broke the list command if no VMs are running. When the list of VMs is empty there are no fields to validate so specifying fields always returns an error. Field validation should be skipped if there are no VMs to make the behaviour of "nova list --fields" consistent with "nova list"

With VMs running:
~$ nova list --fields metadata,created,networks
+--------------------------------------+------------------------------------------------------------+----------------------+-----------------------------------
----------------------+
| ID | Metadata | Created | Networks
                      |
+--------------------------------------+------------------------------------------------------------+----------------------+-----------------------------------
----------------------+
| 4072c7c5-eab4-45f3-a3b8-1b0d010ddf7c | {u'instance': u'my-instance', u'vnfc-type': u'management'} | 2016-09-19T03:11:13Z | internal-network=10
.0.0.3, 192.168.2.68 |
+--------------------------------------+------------------------------------------------------------+----------------------+-----------------------------------
----------------------+

No VMs running:
~$ nova list --fields metadata,created,networks
ERROR (CommandError): Non-existent fields are specified: [u'metadata', u'created', u'networks']

~$ nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+

Revision history for this message
Paul (opencloud-pburrowes) wrote :
description: updated
Revision history for this message
Ali Jabbar (jabbar-ali) wrote :
Download full text (4.6 KiB)

Could you please share what are the steps for reproducing this issue !!

I am not seeing in normal executions

stack@cinv-V:/home/cinv/devstack$ nova list --fields metadata,created,networks
+--------------------------------------+----------+----------------------+----------+
| ID | Metadata | Created | Networks |
+--------------------------------------+----------+----------------------+----------+
| 3beff4cd-a192-4633-99c2-665cde76914f | {} | 2016-10-02T06:40:53Z | |
| 468c10bf-6def-47d8-a804-d69b4c34658e | {} | 2016-10-02T06:46:40Z | |
| 4bb5e5a0-2812-489c-a41e-de04ee0be851 | {} | 2016-10-02T06:33:01Z | |
| bb7426e1-17c7-408d-bae4-278cdf8a44d8 | {} | 2016-10-02T06:45:16Z | |
| d95f5047-692b-4672-a377-60d7e7ddb9bb | {} | 2016-10-02T06:39:34Z | |
+--------------------------------------+----------+----------------------+----------+
stack@cinv-V:/home/cinv/devstack$ nova list
+--------------------------------------+-----------------------------------------------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-----------------------------------------------+--------+------------+-------------+----------+
| 3beff4cd-a192-4633-99c2-665cde76914f | Instance-25b34978-c701-4e70-a7e9-56b3f9754a10 | ERROR | - | Shutdown | |
| 468c10bf-6def-47d8-a804-d69b4c34658e | Instance-6167a8ff-6545-4d8d-8dd3-1b8424b0eda5 | ERROR | - | Shutdown | |
| bb7426e1-17c7-408d-bae4-278cdf8a44d8 | server-1be21545-d03d-4d35-b254-d2d50af09c7e | ERROR | - | Shutdown | |
| d95f5047-692b-4672-a377-60d7e7ddb9bb | server-5f7d5fad-3896-4288-a881-2abaa4a8b258 | ERROR | - | Shutdown | |
| 4bb5e5a0-2812-489c-a41e-de04ee0be851 | server-8bb7748d-e519-45f6-aed1-2d666839647b | ERROR | - | Shutdown | |
+--------------------------------------+-----------------------------------------------+--------+------------+-------------+----------+
stack@cinv-V:/home/cinv/devstack$
stack@cinv-V:/home/cinv/devstack$
stack@cinv-V:/home/cinv/devstack$ nova delete 3beff4cd-a192-4633-99c2-665cde76914f
Request to delete server 3beff4cd-a192-4633-99c2-665cde76914f has been accepted.
stack@cinv-V:/home/cinv/devstack$
stack@cinv-V:/home/cinv/devstack$
stack@cinv-V:/home/cinv/devstack$ nova list | grep ERROR
| 468c10bf-6def-47d8-a804-d69b4c34658e | Instance-6167a8ff-6545-4d8d-8dd3-1b8424b0eda5 | ERROR | - | Shutdown | |
| bb7426e1-17c7-408d-bae4-278cdf8a44d8 | server-1be21545-d03d-4d35-b254-d2d50af09c7e | ERROR | - | Shutdown | |
| d95f5047-692b-4672-a377-60d7e7ddb9bb | server-5f7d5fad-3896-4288-a881-2abaa4a8b258 | ERROR | - | Shutdown | |
| 4bb5e5a0-2812-489c-a41e-de04ee0be851 | server-8bb7748d-e519-45f6-aed1-2d666839647b | ERROR | - | Shutdown | |
stack@cinv-V:/home/cinv/devstack$
stack@cinv-V:/home/cinv/devstack...

Read more...

Changed in python-novaclient:
assignee: nobody → Arvinder Singh (arvinder-singh)
Changed in python-novaclient:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/396074

Changed in python-novaclient:
status: Confirmed → In Progress
Changed in python-novaclient:
assignee: Arvinder Singh (arvinder-singh) → Diana Clarke (diana-clarke)
Changed in python-novaclient:
assignee: Diana Clarke (diana-clarke) → nobody
Changed in python-novaclient:
assignee: nobody → Diana Clarke (diana-clarke)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/396074
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=b98a033d1673b8da8ca261b1dfc6cb0bd6996e9d
Submitter: Jenkins
Branch: master

commit b98a033d1673b8da8ca261b1dfc6cb0bd6996e9d
Author: Arvinder Singh <email address hidden>
Date: Thu Nov 10 15:47:03 2016 +0530

    Fix 'nova list --fields' error in no instances case

    Code changes done so that nova list command with filters run without
    error when no instances are present. It shows a blank table instead of
    error message.

    Closes-Bug: #1624978
    Change-Id: Iff879a520c607b8205a3ce5db8fc92287253dbe0
    Co-Authored-By: Diana Clarke <email address hidden>

Changed in python-novaclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-novaclient 8.0.0

This issue was fixed in the openstack/python-novaclient 8.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.