Reviewed: https://review.openstack.org/272732 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5cad74c27befb8f1bd584753de21d8ca60eaf901 Submitter: Jenkins Branch: master
commit 5cad74c27befb8f1bd584753de21d8ca60eaf901 Author: Balazs Gibizer <[email protected]> Date: Tue Jan 26 21:48:11 2016 +0100 Return HTTP 400 if volume size is not defined Nova API properly checks that in case of booting from a image to volume bdm the client shall specify the size of the created volume. However the API does not handle the exception properly and returns HTTP 500. This patch handles the InvalidBDM exception and returns HTTP 400. Change-Id: I80d0aa64885f25081dad91b1f45da5b318d8ae25 Closes-bug: #1538197 ** 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/1538197 Title: booting from volume throws http 500 if volume size is not specified Status in OpenStack Compute (nova): Fix Released Bug description: If a instance is booted from volume with an image to volume bdm where the volume size is not specified nova throws http 500 instead of http 400. Visible on master (b558d616c3b123dbe2a0914162b45765192f3a12) with devstack. To reproduce: $ nova image-list +--------------------------------------+---------------------------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------------------------------+--------+--------+ | a7e6b974-0b5a-4d60-8d68-d4745aae9bb3 | cirros-0.3.4-x86_64-uec | ACTIVE | | | 10672d57-30b3-4c41-9f5b-f42c030970fa | cirros-0.3.4-x86_64-uec-kernel | ACTIVE | | | 70790401-6760-48d5-9bf4-175d18cfc9d6 | cirros-0.3.4-x86_64-uec-ramdisk | ACTIVE | | +--------------------------------------+---------------------------------+--------+--------+ $ nova boot --flavor 42 --block-device source=image,id=a7e6b974-0b5a-4d60-8d68-d4745aae9bb3,dest=volume,shutdown=preserve,bootindex=0 --poll vm1 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.InvalidBDM'> (HTTP 500) (Request-ID: req-996d695a-3f36-48ee-b91f-567c3ab2f1ce) There is a stack trace in the nova-api log: 2016-01-20 18:51:58.400 ERROR nova.api.openstack.extensions [req-996d695a-3f36-48ee-b91f-567c3ab2f1ce admin admin] Unexpected exception in API method 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions Traceback (most recent call last): 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/extensions.py", line 478, in wrapped 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions return f(*args, **kwargs) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions return func(*args, **kwargs) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions return func(*args, **kwargs) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 604, in create 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions **create_kwargs) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/hooks.py", line 149, in inner 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions rv = f(*args, **kwargs) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1504, in create 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions check_server_group_quota=check_server_group_quota) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1127, in _create_instance 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions instance_group, check_server_group_quota) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 976, in _provision_instances 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions quotas.rollback() 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 204, in __exit__ 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions six.reraise(self.type_, self.value, self.tb) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 939, in _provision_instances 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions num_instances, i, shutdown_terminate) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1422, in create_db_entry_for_new_instance 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions instance.destroy() 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 204, in __exit__ 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions six.reraise(self.type_, self.value, self.tb) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1418, in create_db_entry_for_new_instance 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions context, instance, instance_type, block_device_mapping) 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1254, in _validate_bdm 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions raise exception.InvalidBDM(message=_("Images with " 2016-01-20 18:51:58.400 TRACE nova.api.openstack.extensions InvalidBDM: Images with destination_type 'volume' need to have a non-zero size specified To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1538197/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

