nova boot has unexpected API error

Bug #1599400 reported by Yingxin
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Medium
Unassigned

Bug Description

Description:
=====

Nova allow users to set free-form flavor extra-specs "hw:cpu_policy" and "hw:cpu_thread_policy". However, these values are not true free-form values, but rather enum values. Specifying an invalid value for one of these values, and booting an instance with the invalid flavor will result in an uncaught ValueError in Nova and a HTTP 500 code being returned to the user.

Reproduce:
=====

# 1. create flavor 11 with an illegal extra_spec "hw:cpu_thread_policy=shared"

    $ nova flavor-create test 11 128 1 3
    $ nova flavor-key 11 set hw:cpu_policy=dedicated
    $ nova flavor-key 11 set hw:cpu_thread_policy=shared

# 2. boot an instance from that malformed flavor 11

    $ nova boot --image <image-id> --flavor 11 test

Output:
=====

ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.ValueError'> (HTTP 500) (Request-ID: req-a26ad5f3-7982-4361-8817-0ab111ac9ab1)

Yingxin (cyx1231st)
description: updated
summary: - nova boot unexpected API error
+ nova boot has unexpected API error
Revision history for this message
Stephen Finucane (stephenfinucane) wrote :

@Yingxin What version of OpenStack was this against?

Changed in nova:
assignee: nobody → Stephen Finucane (sfinucan)
description: updated
Changed in nova:
assignee: Stephen Finucane (sfinucan) → nobody
Changed in nova:
status: New → Confirmed
Revision history for this message
Yingxin (cyx1231st) wrote :

@sfinucan: the latest master code. It's very easy to reproduce.

Changed in nova:
assignee: nobody → viswesuwara nathan (viswesn)
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
viswesuwara nathan (viswesn) wrote :

I am new to OpenStack development and this is first bug I started working on.

Do we need to address this issue during "nova flavor-key ...." or we need to throw an appropriate error message during "nova boot" showing "Invalid value 'shared' specified for hw:cpu_thread_policy" ?

Currently nova client doesn't contain all the keys and values that were supported for creating flavor.
so can I go ahead and address this issue as part of "nova boot" by showing appropriate error message? please guide me on this.

Revision history for this message
Yingxin (cyx1231st) wrote :

@viswesn: The nova-api shouldn't report HTTP 500 to users. At least, it should report why nova boot operation is failed (i.e. because of improper settings of flavor extra_specs).

Revision history for this message
viswesuwara nathan (viswesn) wrote :

@Yingxin: Thanks for the update; I will start working on fixing the issue by throwing an appropriate error as "Invalid value 'shared' specified for hw:cpu_thread_policy".

Surya Rudra (rudrasurya)
Changed in nova:
assignee: viswesuwara nathan (viswesn) → Surya Rudra (rudrasurya)
Yingxin (cyx1231st)
Changed in nova:
assignee: Surya Rudra (rudrasurya) → Yingxin (cyx1231st)
Revision history for this message
Zhenyu Zheng (zhengzhenyu) wrote :

I don't think it should be a enum value, vendors may add custom filters and uses custom extra_specs to make their filter work, so the better solution will be add guides to the user documentation about what are the "built-in" flavor extra-sepcs. It has been done in: https://review.openstack.org/#/c/395925/

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

Yingxin (cyx1231st)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in nova:
assignee: Yingxin (cyx1231st) → Ken'ichi Ohmichi (oomichi)
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/406377

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

Change abandoned by Sean Dague (<email address hidden>) on branch: master
Review: https://review.openstack.org/404565
Reason: This review is > 4 weeks without comment, and is not mergable in it's current state. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
Stephen Finucane (stephenfinucane) wrote :

The move to validate these parameters at the API layer introduced in Stein combined with the flavor extra spec validation work in Ussuri (API microversion 2.86 or later) should have seen off this issue.

Changed in nova:
status: In Progress → Won't Fix
assignee: Ken'ichi Ohmichi (oomichi) → nobody
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.