← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1846656] [NEW] Compute API in nova - show/list servers with details says security_groups is required in response but it's optional

 

Public bug reported:

- [x] This doc is inaccurate in this way:

This came up in review:

https://review.opendev.org/#/c/685927/2//COMMIT_MSG@9

https://docs.openstack.org/api-ref/compute/#show-server-details

and

https://docs.openstack.org/api-ref/compute/#list-servers-detailed

response parameter tables both say that "security_groups" is a required
field in the response but that's not true if the server does not have
any attached ports which is possible. This is the server view builder
code:

https://github.com/openstack/nova/blob/867401e575d2b27b9bc63ceda41cd85233545cd5/nova/api/openstack/compute/views/servers.py#L627

Note the key is not in the GET response if the server is not attached to
any ports that have security groups.

I recreated in devstack by creating a server with no network:

$ openstack --os-compute-api-version 2.37 server create --flavor m1.tiny
--image cirros-0.4.0-x86_64-disk --nic none --wait vm-no-net

And the security_groups key is not in the GET /servers/detail response:

$ curl -H "X-Auth-Token: $token" http://10.128.0.6/compute/v2.1/servers/detail | python -m json.tool | grep security_groups
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1388  100  1388    0     0   8213      0 --:--:-- --:--:-- --:--:--  8213


-----------------------------------
Release:  on 2019-09-19 17:55:19
SHA: 9ca14e081860b1abcc0d676f253a472028690e29
Source: https://opendev.org/openstack/nova/src/api-ref/source/index.rst
URL: https://docs.openstack.org/api-ref/compute/

** Affects: nova
     Importance: Low
         Status: Triaged


** Tags: api-ref doc low-hanging-fruit

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1846656

Title:
  Compute API in nova - show/list servers with details says
  security_groups is required in response but it's optional

Status in OpenStack Compute (nova):
  Triaged

Bug description:
  - [x] This doc is inaccurate in this way:

  This came up in review:

  https://review.opendev.org/#/c/685927/2//COMMIT_MSG@9

  https://docs.openstack.org/api-ref/compute/#show-server-details

  and

  https://docs.openstack.org/api-ref/compute/#list-servers-detailed

  response parameter tables both say that "security_groups" is a
  required field in the response but that's not true if the server does
  not have any attached ports which is possible. This is the server view
  builder code:

  https://github.com/openstack/nova/blob/867401e575d2b27b9bc63ceda41cd85233545cd5/nova/api/openstack/compute/views/servers.py#L627

  Note the key is not in the GET response if the server is not attached
  to any ports that have security groups.

  I recreated in devstack by creating a server with no network:

  $ openstack --os-compute-api-version 2.37 server create --flavor
  m1.tiny --image cirros-0.4.0-x86_64-disk --nic none --wait vm-no-net

  And the security_groups key is not in the GET /servers/detail
  response:

  $ curl -H "X-Auth-Token: $token" http://10.128.0.6/compute/v2.1/servers/detail | python -m json.tool | grep security_groups
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100  1388  100  1388    0     0   8213      0 --:--:-- --:--:-- --:--:--  8213

  
  -----------------------------------
  Release:  on 2019-09-19 17:55:19
  SHA: 9ca14e081860b1abcc0d676f253a472028690e29
  Source: https://opendev.org/openstack/nova/src/api-ref/source/index.rst
  URL: https://docs.openstack.org/api-ref/compute/

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1846656/+subscriptions


Follow ups