← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1614097] Re: nova boot fails with 500 InternalServerError for invalid snapshot id

 

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

commit 86bce560ec62d8813903bdd0b13ca9840dc0dcf7
Author: bhagyashris <bhagyashri.shewale@xxxxxxxxxxx>
Date:   Fri Aug 19 19:21:46 2016 +0530

    Return 400 error for non-existing snapshot_id
    
    If you pass non-existing snapshot_id to the boot server api,
    it returns HTTP 500 error.
    This patch fixes this issue by catching SnapshotNotFound
    exception and raising HTTPBadRequest in controller.
    
    Closes-Bug: #1614097
    Change-Id: Ieea5b4815e9078f9c22069a6fb772cd67b8de3a2


** Changed in: nova
       Status: In Progress => Fix Released

-- 
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/1614097

Title:
  nova boot fails with 500 InternalServerError for invalid snapshot id

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  If you pass an invalid snapshot while creating the instance then it's returning 500 InternalServerError. 
  Ideally it should return 400 HTTPBadRequest as snapshot doesn't exists.

  Steps to reproduce:

  Command:

  nova boot --snapshot <invalid-snapshot-id> --flavor 1 new2

  Output:

  ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
  <class 'nova.exception.SnapshotNotFound'> (HTTP 500) (Request-ID: req-ead10ac5-5b57-4497-b772-66cd40b5e2eb)

  
  n-api logs:

  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 576, in create
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     **create_kwargs)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/hooks.py", line 154, in inner
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     rv = f(*args, **kwargs)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/api.py", line 1511, in create
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     check_server_group_quota=check_server_group_quota)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/api.py", line 1101, in _create_instance
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     context, block_device_mapping, legacy_bdm)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/api.py", line 1036, in _get_bdm_image_metadata
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     snapshot = self.volume_api.get_snapshot(context, snapshot_id)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/volume/cinder.py", line 188, in wrapper
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     res = method(self, ctx, *args, **kwargs)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/volume/cinder.py", line 227, in wrapper
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     _reraise(exception.SnapshotNotFound(snapshot_id=snapshot_id))
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/volume/cinder.py", line 246, in _reraise
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     six.reraise(type(desired_exc), desired_exc, sys.exc_info()[2])
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/volume/cinder.py", line 225, in wrapper
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     res = method(self, ctx, snapshot_id, *args, **kwargs)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/volume/cinder.py", line 463, in get_snapshot
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     item = cinderclient(context).volume_snapshots.get(snapshot_id)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/cinderclient/v3/volume_snapshots.py", line 107, in get
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     return self._get("/snapshots/%s" % snapshot_id, "snapshot")
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/cinderclient/base.py", line 303, in _get
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     resp, body = self.api.client.get(url)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/cinderclient/client.py", line 143, in get
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     return self._cs_request(url, 'GET', **kwargs)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/cinderclient/client.py", line 134, in _cs_request
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     return self.request(url, method, **kwargs)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/cinderclient/client.py", line 123, in request
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions     raise exceptions.from_response(resp, body)
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions SnapshotNotFound: Snapshot cfa5f789-6771-4fb0-abe3-b82301bbab86 could not be found.
  2016-08-17 17:05:48.033 TRACE nova.api.openstack.extensions

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


References