← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1525806] Re: An incorrect value for block_device_mapping_v2 causes HTTP 500 response when creating a VM instance

 

Reviewed:  https://review.openstack.org/258788
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9ad3dad0c6ab868566e74f0c35a5375d4eaad560
Submitter: Jenkins
Branch:    master

commit 9ad3dad0c6ab868566e74f0c35a5375d4eaad560
Author: Takashi NATSUME <natsume.takashi@xxxxxxxxxxxxx>
Date:   Mon Mar 14 14:26:11 2016 +0900

    Add validations for volume_size and destination_type
    
    Add validations for volume_size and destination_type of
    block device mapping when creating an instance
    in order to avoid HTTP 500 errors.
    Validations has been added in V2.1 API only.
    Validations that has been added are as follows:
    
    * volume_size: an empty string
    * volume_size: zero
    * volume_size: greater than DB column's limit
    * destination_type: an empty string
    * destination_type: invalid value
    
    Change-Id: I2d3084cccd15f409616031f106c611ff07ac4abf
    Closes-Bug: #1525806


** 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/1525806

Title:
  An incorrect value for block_device_mapping_v2 causes HTTP 500
  response when creating a VM instance

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  An incorrect value for block_device_mapping_v2 causes HTTP 500 response when creating a VM instance.
  It should be validated and not to return HTTP 500 response.

  [How to reproduce]
  a) destination_type is ""(an empty string)
  Execute the following command(REST API).
  curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.0.2.15:8774/v2.1/e7e043ffac8d4325b2872bd2b53cce2b/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}00abb28e025a6770fc13d70fc6a41e327bca90d6" -d '{"server": {"name": "server1", "imageRef": "", "block_device_mapping_v2": [{"boot_index": "0", "uuid": "4115a0d1-eee2-4c3e-847d-e50250a989a3", "volume_size": "1", "source_type": "image", "destination_type": "", "delete_on_termination": false}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

  The response is as follows:
  --------------------------------------
  HTTP/1.1 500 Internal Server Error
  X-Openstack-Nova-Api-Version: 2.6
  Vary: X-OpenStack-Nova-API-Version
  Content-Length: 194
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-29fb2efe-eda8-43dd-8ea1-5f73b86f6171
  Date: Mon, 14 Dec 2015 07:17:24 GMT

  {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.ValueError'>", "code": 500}}
  --------------------------------------

  b) destination_type is neither 'volume' nor 'local'
  Execute the following command(REST API).
  curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.0.2.15:8774/v2.1/e7e043ffac8d4325b2872bd2b53cce2b/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}7add7a5e501cc287f6043d83144ea24a69134ae7" -d '{"server": {"name": "server1", "imageRef": "", "block_device_mapping_v2": [{"boot_index": "0", "uuid": "4115a0d1-eee2-4c3e-847d-e50250a989a3", "volume_size": "1", "source_type": "image", "destination_type": "XXXXX", "delete_on_termination": false}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

  The response is as follows:
  --------------------------------------
  HTTP/1.1 500 Internal Server Error
  X-Openstack-Nova-Api-Version: 2.6
  Vary: X-OpenStack-Nova-API-Version
  Content-Length: 194
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-f3644722-ba2c-49bf-9db0-badfd7dffa30
  Date: Mon, 14 Dec 2015 07:30:02 GMT

  {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.ValueError'>", "code": 500}}
  --------------------------------------

  c) volume_size is ""(an empty string)
  Execute the following command(REST API).
  curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.0.2.15:8774/v2.1/e7e043ffac8d4325b2872bd2b53cce2b/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}85cc81c3f710561ddd640ce26c41990703d925ce" -d '{"server": {"name": "server1", "imageRef": "", "block_device_mapping_v2": [{"boot_index": "0", "uuid": "4115a0d1-eee2-4c3e-847d-e50250a989a3", "volume_size": "", "source_type": "image", "destination_type": "volume", "delete_on_termination": false}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

  The response is as follows:
  --------------------------------------
  HTTP/1.1 500 Internal Server Error
  X-Openstack-Nova-Api-Version: 2.1
  Vary: X-OpenStack-Nova-API-Version
  Content-Length: 194
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-46cb61d3-c110-4bbb-9248-3ebe0f909c23
  Date: Mon, 14 Dec 2015 07:36:27 GMT

  {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.ValueError'>", "code": 500}}
  --------------------------------------

  d) volume_size is 0
  Execute the following command(REST API).
  curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.0.2.15:8774/v2.1/e7e043ffac8d4325b2872bd2b53cce2b/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}85cc81c3f710561ddd640ce26c41990703d925ce" -d '{"server": {"name": "server1", "imageRef": "", "block_device_mapping_v2": [{"boot_index": "0", "uuid": "4115a0d1-eee2-4c3e-847d-e50250a989a3", "volume_size": "0", "source_type": "image", "destination_type": "volume", "delete_on_termination": false}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

  The response is as follows:
  --------------------------------------
  HTTP/1.1 500 Internal Server Error
  X-Openstack-Nova-Api-Version: 2.1
  Vary: X-OpenStack-Nova-API-Version
  Content-Length: 199
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-ed2f5bce-704c-4fb4-bd64-8246746a28a8
  Date: Mon, 14 Dec 2015 07:38:27 GMT

  {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<class 'nova.exception.InvalidBDM'>", "code": 500}}
  --------------------------------------

  e) volume_size is more than DB column limit(> 9223372036854775807)
  Execute the following command(REST API).
  curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.0.2.15:8774/v2.1/e7e043ffac8d4325b2872bd2b53cce2b/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}85cc81c3f710561ddd640ce26c41990703d925ce" -d '{"server": {"name": "server1", "imageRef": "", "block_device_mapping_v2": [{"boot_index": "0", "uuid": "4115a0d1-eee2-4c3e-847d-e50250a989a3", "volume_size": "9223372036854775808", "source_type": "image", "destination_type": "volume", "delete_on_termination": false}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

  The response is as follows:
  --------------------------------------
  HTTP/1.1 500 Internal Server Error
  X-Openstack-Nova-Api-Version: 2.1
  Vary: X-OpenStack-Nova-API-Version
  Content-Length: 203
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-b8815b21-33ff-4a9b-94bb-7cc72663f868
  Date: Mon, 14 Dec 2015 07:39:59 GMT

  {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<class 'oslo_db.exception.DBDataError'>", "code": 500}}
  --------------------------------------

  [Environment]
  OS: Ubuntu 14.04 LTS
  nova: master(commit: 415b221e3345e332f78c9833c2e4e7f0d38bf9c5)

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


References