client sometimes responds with 400 when trying to get status of server very soon after boot.

Bug #1772926 reported by Alex Kavanagh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Expired
Undecided
Unassigned

Bug Description

I suspect that this is a race hazard as it doesn't always occur, although some versions of OpenStack trigger it more that others (e.g. Ocata).

Essentially, what happens is:

1. We use the python-novaclient to start a server (NOT using the wait parameter).
2. As soon as that function returns, we try and list the instances, so we can find out if our has reached the ACTIVE stage. Note that it is usually the only instance.
3. Sometimes nova_client.servers.findall(...) raises a 400 error.

Relevant code:

instance = nova_client.servers.create(name=vm_name, image=image, flavor=flavor, key_name=key_name, nics=nics)
..
instance = nova_client.servers.findall(name=vm_name)[0]

^^^ where 400 is raised.

Note that we use the slightly odd find_all() as:

# In pike+ servers.find throws a novaclient.exceptions.NoUniqueMatch
# exception. Subsequent calls work for some reason. Either way just
# use the first element reduced by servers.findall

An example of the backtrace is:

2018-05-22 11:44:26 [INFO] Creating m1.small trusty [{'net-id': u'32518ef5-2eb9-49e7-99a1-91e2cc3613ea'}]instance 20180522114426
2018-05-22 11:44:35 [INFO] Issued boot
2018-05-22 11:44:35 [INFO] Launched <Server: 20180522114426>
2018-05-22 11:44:35 [INFO] Waiting for boot
2018-05-22 11:44:35 [INFO] Waiting 180s for 20180522114426 to reach ACTIVE state
Traceback (most recent call last):
  File "/srv/mojo/openstack/xenial/_20180122_110116/spec/specs/full_stack/next_ha_vrrp/ocata/simple_os_checks.py", line 99, in <module>
    sys.exit(main(sys.argv))
  File "/srv/mojo/openstack/xenial/_20180122_110116/spec/specs/full_stack/next_ha_vrrp/ocata/simple_os_checks.py", line 95, in main
    ping_wait=ping_wait)
  File "/home/ubuntu/srv/mojo/openstack/xenial/_20180122_110116/spec/helper/tests/utils/mojo_os_utils.py", line 1025, in boot_and_test
    cloudinit_wait)
  File "/home/ubuntu/srv/mojo/openstack/xenial/_20180122_110116/spec/helper/tests/utils/mojo_os_utils.py", line 879, in wait_for_boot
    if not wait_for_active(nova_client, vm_name, active_wait):
  File "/home/ubuntu/srv/mojo/openstack/xenial/_20180122_110116/spec/helper/tests/utils/mojo_os_utils.py", line 846, in wait_for_active
    instance = nova_client.servers.findall(name=vm_name)[0]
  File "/home/ubuntu/.virtualenvs/mojo-venv/local/lib/python2.7/site-packages/novaclient/base.py", line 473, in findall
    listing = self.list(**list_kwargs)
  File "/home/ubuntu/.virtualenvs/mojo-venv/local/lib/python2.7/site-packages/novaclient/v2/servers.py", line 854, in list
    "servers")
  File "/home/ubuntu/.virtualenvs/mojo-venv/local/lib/python2.7/site-packages/novaclient/base.py", line 257, in _list
    resp, body = self.api.client.get(url)
  File "/home/ubuntu/.virtualenvs/mojo-venv/local/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 304, in get
    return self.request(url, 'GET', **kwargs)
  File "/home/ubuntu/.virtualenvs/mojo-venv/local/lib/python2.7/site-packages/novaclient/client.py", line 83, in request
    raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.BadRequest: marker [6e5a6d5f-4875-49ff-a5cf-5251d35a4c01] not found (HTTP 400) (Request-ID: req-fc34dca5-79a4-4c0d-9d10-8e96f4adb2a9)

Revision history for this message
Takashi Natsume (natsume-takashi) wrote :

Which version of python-novaclient did you use?
Was it 7.1.2?

Changed in python-novaclient:
status: New → Incomplete
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

Sorry for the delay.

$ pip freeze | grep python-novaclient
python-novaclient==10.2.0

Thanks.

Revision history for this message
Takashi Natsume (natsume-takashi) wrote :

Probably it is the same issue.

nova client servers.list crashes with bad marker
https://bugs.launchpad.net/nova/+bug/1773945

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for python-novaclient because there has been no activity for 60 days.]

Changed in python-novaclient:
status: Incomplete → Expired
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.