list-secgroup fail if no secgroups defined for server

Bug #1291489 reported by Bhuvan Arumugam
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Leandro Ignacio Costantino
Havana
Fix Released
Undecided
Unassigned
Icehouse
Fix Released
Undecided
Unassigned

Bug Description

No issues if there are atleast 1 secgroup defined for the server.

If no secgroups are defined for the server, it fails with 400 error.

$ nova --debug list-secgroup vp25q00cs-osfe11b124f4.isg.apple.com
.
.
.
RESP: [400] CaseInsensitiveDict({'date': 'Wed, 12 Mar 2014 17:08:11 GMT', 'content-length': '141', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-20cb1b69-a69c-435c-9e85-3eec2fb2ae61'})
RESP BODY: {"badRequest": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400}}

DEBUG (shell:740) The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400) (Request-ID: req-20cb1b69-a69c-435c-9e85-3eec2fb2ae61)
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/novaclient/shell.py", line 737, in main
    OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
  File "/Library/Python/2.7/site-packages/novaclient/shell.py", line 673, in main
    args.func(self.cs, args)
  File "/Library/Python/2.7/site-packages/novaclient/v1_1/shell.py", line 1904, in do_list_secgroup
    groups = server.list_security_group()
  File "/Library/Python/2.7/site-packages/novaclient/v1_1/servers.py", line 328, in list_security_group
    return self.manager.list_security_group(self)
  File "/Library/Python/2.7/site-packages/novaclient/v1_1/servers.py", line 883, in list_security_group
    base.getid(server), 'security_groups', SecurityGroup)
  File "/Library/Python/2.7/site-packages/novaclient/base.py", line 61, in _list
    _resp, body = self.api.client.get(url)
  File "/Library/Python/2.7/site-packages/novaclient/client.py", line 229, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/Library/Python/2.7/site-packages/novaclient/client.py", line 213, in _cs_request
    **kwargs)
  File "/Library/Python/2.7/site-packages/novaclient/client.py", line 195, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/Library/Python/2.7/site-packages/novaclient/client.py", line 189, in request
    raise exceptions.from_response(resp, body, url, method)
BadRequest: The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400) (Request-ID: req-20cb1b69-a69c-435c-9e85-3eec2fb2ae61)
ERROR: The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400) (Request-ID: req-20cb1b69-a69c-435c-9e85-3eec2fb2ae61)

Tracy Jones (tjones-i)
tags: added: api
Changed in nova:
assignee: nobody → Leandro Ignacio Costantino (leandro-i-costantino)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/80097
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c32986966dfd034c3d706b2e9ab2820a2c3cfc3e
Submitter: Jenkins
Branch: master

commit c32986966dfd034c3d706b2e9ab2820a2c3cfc3e
Author: Leandro I. Costantino <email address hidden>
Date: Wed Mar 12 19:13:16 2014 -0300

    Fix security group list when not defined for an instance

    If an instance has an empty security group list an exception
    is thrown due to iteration attempt of None.

    To fix this, this patch modifies get_instance_security_group
    to return an empty list instead of None.

    Change-Id: I7efb3c3a58d7e20501d126c6d194479ca1d14166
    Closes-Bug: #1291489

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-1
status: Fix Committed → Fix Released
tags: added: havana-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/106674

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/106675

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/icehouse)

Reviewed: https://review.openstack.org/106675
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b08f62a7a63559b0300fbbcaaaca97401f0403f8
Submitter: Jenkins
Branch: stable/icehouse

commit b08f62a7a63559b0300fbbcaaaca97401f0403f8
Author: Leandro I. Costantino <email address hidden>
Date: Wed Mar 12 19:13:16 2014 -0300

    Fix security group list when not defined for an instance

    If an instance has an empty security group list an exception
    is thrown due to iteration attempt of None.

    To fix this, this patch modifies get_instance_security_group
    to return an empty list instead of None.

    Change-Id: I7efb3c3a58d7e20501d126c6d194479ca1d14166
    Closes-Bug: #1291489
    (cherry picked from commit c32986966dfd034c3d706b2e9ab2820a2c3cfc3e)

tags: added: in-stable-icehouse
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/havana)

Reviewed: https://review.openstack.org/106674
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6da5e15d3b6ab51c3466517e7b63e1c25d67fce4
Submitter: Jenkins
Branch: stable/havana

commit 6da5e15d3b6ab51c3466517e7b63e1c25d67fce4
Author: Leandro I. Costantino <email address hidden>
Date: Wed Mar 12 19:13:16 2014 -0300

    Fix security group list when not defined for an instance

    If an instance has an empty security group list an exception
    is thrown due to iteration attempt of None.

    To fix this, this patch modifies get_instance_security_group
    to return an empty list instead of None.

    Conflicts:
     nova/tests/api/openstack/compute/contrib/test_neutron_security_groups.py
     nova/tests/network/security_group/test_neutron_driver.py

    Change-Id: I7efb3c3a58d7e20501d126c6d194479ca1d14166
    Closes-Bug: #1291489
    (cherry picked from commit c32986966dfd034c3d706b2e9ab2820a2c3cfc3e)

tags: added: in-stable-havana
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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