← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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

** Affects: nova
     Importance: Undecided
     Assignee: Dinesh Bhor (dinesh-bhor)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => Dinesh Bhor (dinesh-bhor)

-- 
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):
  New

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


Follow ups