HTTP 500 when calling os-volume_boot with invalid destination_type

Bug #1651064 reported by Zhenyu Zheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Ken'ichi Ohmichi
Mitaka
Fix Released
Medium
Ken'ichi Ohmichi
Newton
Fix Committed
Medium
Ken'ichi Ohmichi

Bug Description

When calling os-volume_boot with invalid bdm destination_type (e.g. volume1 as a typo of volume) HTTP 500 will raise.

Setp 1: call os-volumes_boot API or use "nova boot" CLI with --block-device provided(it will call os-volumes_boot)

nova-api log for my test can be found in:
http://paste.openstack.org/show/592762/

Changed in nova:
assignee: nobody → Zhenyu Zheng (zhengzhenyu)
Revision history for this message
Rikimaru Honjo (honjo-rikimaru-c6) wrote :

I can't reproduce this case by your explanation.
Validation works correctly.
This bug was maybe already fixed.

Reproduce:

I used latest nova on Dec 12,16(7e1f1f68ebc05deabcb308d5918c88563b483833).

$ curl -g -i -X POST http://127.0.0.1:8774/v2.1/os-volumes_boot -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "OpenStack-API-Version: compute 2.37" -H "X-OpenStack-Nova-API-Version: 2.37" -H "X-Auth-Token: gAAAAABYWg2CF13hBj9axkqmhfWk3X_7O_Zf6vORx52A3P8Ed3ZYbIQIFaDyAY45C95R-jIX68YQW-GYTtk9yyjBwMI8ng9pfeUScqIShPiw-g7rp5RsChMSoTsE0NYW5FOFy0XJWoL814o3_n3NkPPrzqp329Jyxr4xIdHqaq_5lEA_irxxmE0" -H "Content-Type: application/json" -d '{"server": {"name": "testvm", "block_device_mapping_v2": [{"source_type": "volume", "uuid": "cfff5649-d9c8-4b16-9cef-788eb080ccc5", "destination_type": "volume1"},{"source_type": "image", "delete_on_termination": true, "boot_index": 0, "uuid": "5ccdf68c-03f6-4dc5-a936-96903a12ed6e", "destination_type": "local"}], "flavorRef": "1", "max_count": 1, "min_count": 1, "networks": [{"uuid": "a9a98594-c2b9-4523-825c-873a3182272e"}]}}'
HTTP/1.1 400 Bad Request
Openstack-Api-Version: compute 2.37
X-Openstack-Nova-Api-Version: 2.37
Vary: OpenStack-API-Version
Vary: X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 156
X-Compute-Request-Id: req-9d580023-438a-412d-8b27-d682af59a184
Date: Wed, 21 Dec 2016 05:39:04 GMT

{"badRequest": {"message": "Invalid input for field/attribute destination_type. Value: volume1. u'volume1' is not one of ('local', 'volume')", "code": 400}}

Nova validates correctly.

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

Thanks for reporting Honjo-san.
The error message (Invalid input for field/attribute ..) seems that JSON-Schema works fine.
So I mark it as invalid.

Changed in nova:
status: New → Invalid
Revision history for this message
Zhenyu Zheng (zhengzhenyu) wrote :

@Ken'ichi, @Honjo, I just tested with the master branch:

root@zhenyu-dev:/opt/stack/nova# git log
commit 7e1f1f68ebc05deabcb308d5918c88563b483833
Merge: 5eb3144 9f12b59
Author: Jenkins <email address hidden>
Date: Tue Dec 20 09:28:10 2016 +0000

    Merge "Mark sibling CPUs as 'used' for cpu_thread_policy = 'isolated'"

and it still errors 500:
root@zhenyu-dev:/opt/stack/nova# curl -g -i -X POST http://10.3.150.17:8774/v2.1/os-volumes_boot -H "Accept: application/json" -H "OpenStack-API-Version: compute 2.37" -H "X-OpenStack-Nova-API-Version: 2.37" -H "X-Auth-Token: gAAAAABYWh6fFcQ08ljYnyrZ1Dt-9A1T9NUohkZoPWJzzAdkuYulPtIM-HOYbpQnF9t4cf9YJAAXBujKIjmulRT7uiCG2T3dnCf1slX1xSaHQi35ZoQSQHxtqCz4ATgdue1J2UQJzSTvs-1ZUwxihkWZiq9SYtBDPmfSorr4CwOaqqHOpiKjaV0" -H "Content-Type: application/json" -d '{"server": {"name": "test3", "imageRef": "2ff3a1d3-ed70-4c3f-94ac-941461153bc0", "block_device_mapping_v2": [{"source_type": "image", "delete_on_termination": true, "boot_index": 0, "uuid": "2ff3a1d3-ed70-4c3f-94ac-941461153bc0", "destination_type": "local"}, {"source_type": "volume", "uuid": "99d92140-3d0c-4ea5-a49c-f94c38c607f0", "destination_type": "volume1"}], "flavorRef": "2", "max_count": 1, "min_count": 1, "networks": [{"uuid": "474cde7c-d959-46c1-a62e-4810058ba3a8"}]}}'
HTTP/1.1 500 Internal Server Error
Openstack-Api-Version: compute 2.37
X-Openstack-Nova-Api-Version: 2.37
Vary: OpenStack-API-Version
Vary: X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 194
X-Compute-Request-Id: req-bf219650-fbf2-4573-bf07-5f7fcbf35271
Date: Wed, 21 Dec 2016 06:25:53 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}}root@zhenyu-dev:/opt/stack/nova#

Revision history for this message
Zhenyu Zheng (zhengzhenyu) wrote :

I also test again on another devstack env it is the same, full call log can be found in:
http://paste.openstack.org/show/592984/

Revision history for this message
Zhenyu Zheng (zhengzhenyu) wrote :

nova-api log is pasted in here:
http://paste.openstack.org/show/592985/

Revision history for this message
Rikimaru Honjo (honjo-rikimaru-c6) wrote :

@Zhenyu,

Sorry, I succeeded in reproducing.

$ curl -g -i -X POST http://127.0.0.1:8774/v2.1/os-volumes_boot -H "Accept: application/json" -H "OpenStack-API-Version: compute 2.37" -H "X-OpenStack-Nova-API-Version: 2.37" \
> -H "X-Auth-Token: gAAAAABYWiW9XJMCFRjQntKQKpiXY3l2TIdZn_5rB3eE4jxEYndVZZNT5hP3AzvKdft3cX3XUvF3TluDMK9BvDDL27V5NFzpIRMFdkO2NzZ3G2ghE3KhegQ9EFiH7SYaAlgE7GxcvG05bVwEJ2CmcvwLcaXZx3pWhX1YWfZ31YsCA4Nioxbbm1I" \
> -H "Content-Type: application/json" \
> -d '{"server": {"name": "test3", "imageRef": "5ccdf68c-03f6-4dc5-a936-96903a12ed6e", "block_device_mapping_v2": [{"source_type": "image", "delete_on_termination": true, "boot_index": 0, "uuid": "5ccdf68c-03f6-4dc5-a936-96903a12ed6e", "destination_type": "local"}, {"source_type": "volume", "uuid": "cfff5649-d9c8-4b16-9cef-788eb080ccc5", "destination_type": "volume1"}], "flavorRef": "2", "max_count": 1, "min_count": 1, "networks": [{"uuid": "a9a98594-c2b9-4523-825c-873a3182272e"}]}}'
HTTP/1.1 500 Internal Server Error
Openstack-Api-Version: compute 2.37
X-Openstack-Nova-Api-Version: 2.37
Vary: OpenStack-API-Version
Vary: X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 194
X-Compute-Request-Id: req-5c0ae033-9da6-4a31-921e-745c85312f6a
Date: Wed, 21 Dec 2016 06:51:54 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}}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/413452

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/413453

Changed in nova:
assignee: Zhenyu Zheng (zhengzhenyu) → Ken'ichi Ohmichi (oomichi)
status: Invalid → In Progress
tags: added: mitaka-backport-potential
tags: added: newton-backport-potential
Changed in nova:
assignee: Ken'ichi Ohmichi (oomichi) → Zhenyu Zheng (zhengzhenyu)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Ken'ichi Ohmichi (<email address hidden>) on branch: master
Review: https://review.openstack.org/413452
Reason: Yeah, you are right.
This was just for distinguishing the difference of issue patterns.
And maybe this would block a little to backpart the patch to stable branches.
So it is nice to drop that.

Changed in nova:
assignee: Zhenyu Zheng (zhengzhenyu) → Ken'ichi Ohmichi (oomichi)
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit a65551ecd09b3116a13d9b6cc833be0c05b716da
Author: Ken'ichi Ohmichi <email address hidden>
Date: Tue Dec 20 23:20:43 2016 -0800

    Fix BDM JSON-Schema validation

    Current BDM JSON-Schema validation doesn't work for invalid device
    parameter in 2nd dict, because JSON-Schema definition is wrong.
    This patch fixes it.

    Co-Authored-By: Zhenyu Zheng <email address hidden>

    Change-Id: I56348dc2b7abd9526dfbf21305755505765811c5
    Closes-Bug: #1651064

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/415335

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/415343

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/415346

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/mitaka)

Change abandoned by Ken'ichi Ohmichi (<email address hidden>) on branch: stable/mitaka
Review: https://review.openstack.org/415343

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/415335
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c00d433d2951386648260f005c5cb0ffd159dca4
Submitter: Jenkins
Branch: stable/newton

commit c00d433d2951386648260f005c5cb0ffd159dca4
Author: Ken'ichi Ohmichi <email address hidden>
Date: Tue Dec 20 23:20:43 2016 -0800

    Fix BDM JSON-Schema validation

    Current BDM JSON-Schema validation doesn't work for invalid device
    parameter in 2nd dict, because JSON-Schema definition is wrong.
    This patch fixes it.

    Co-Authored-By: Zhenyu Zheng <email address hidden>

    Change-Id: I56348dc2b7abd9526dfbf21305755505765811c5
    Closes-Bug: #1651064
    (cherry picked from commit a65551ecd09b3116a13d9b6cc833be0c05b716da)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/mitaka)

Reviewed: https://review.openstack.org/415346
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d726e0d7008354dcc054b5d8b95b6071c83f8da2
Submitter: Jenkins
Branch: stable/mitaka

commit d726e0d7008354dcc054b5d8b95b6071c83f8da2
Author: Ken'ichi Ohmichi <email address hidden>
Date: Tue Dec 20 23:20:43 2016 -0800

    Fix BDM JSON-Schema validation

    Current BDM JSON-Schema validation doesn't work for invalid device
    parameter in 2nd dict, because JSON-Schema definition is wrong.
    This patch fixes it.

    Co-Authored-By: Zhenyu Zheng <email address hidden>

    Conflicts:
            nova/api/openstack/compute/schemas/block_device_mapping.py
            nova/tests/unit/api/openstack/compute/test_block_device_mapping.py

    NOTE(mriedem): The conflicts were due to some additional validation and
    tests added for BDMs v2.1 in Newton which are not in Mitaka.

    Change-Id: I56348dc2b7abd9526dfbf21305755505765811c5
    Closes-Bug: #1651064
    (cherry picked from commit a65551ecd09b3116a13d9b6cc833be0c05b716da)
    (cherry picked from commit c00d433d2951386648260f005c5cb0ffd159dca4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b3

This issue was fixed in the openstack/nova 15.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.4

This issue was fixed in the openstack/nova 14.0.4 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 13.1.3

This issue was fixed in the openstack/nova 13.1.3 release.

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.