Architecture ValueError Uncaught API Exception

Bug #1558866 reported by Russell Holloway
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann
Liberty
Fix Released
Medium
Lee Yarwood
Mitaka
Fix Released
Medium
Matt Riedemann
OpenStack Dashboard (Horizon)
Opinion
Undecided
Unassigned

Bug Description

If an image is imported with an invalid Architecture, instances are unable to launch and cause a ValueError exception. This exception is only visible in logs and UI only tells user an exception occurred. Running Mirantis Openstack 8.0 (nova-api 2:12.0.0-1~u14.04+mos43)

2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/objects/image_meta.py", line 457, in from_dict
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions obj._set_attr_from_legacy_names(image_props)
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/objects/image_meta.py", line 388, in _set_attr_from_legacy_names
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions setattr(self, new_key, image_props[legacy_key])
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/oslo_versionedobjects/base.py", line 72, in setter
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions field_value = field.coerce(self, name, value)
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/oslo_versionedobjects/fields.py", line 189, in coerce
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions return self._type.coerce(obj, attr, value)
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/objects/fields.py", line 87, in coerce
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions raise ValueError(msg)
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions ValueError: Architecture name 'x64' is not valid
2016-03-18 01:13:35.846 28025 ERROR nova.api.openstack.extensions
2016-03-18 01:13:35.848 28025 INFO nova.api.openstack.wsgi [req-f56ff830-6e2d-46ab-b1a3-50f021725374 813401d7df1d4ad68388dee16def6a6b 9e90e9d0bb8c43b3a6fa3d2b1fb08efa - - -] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.

Reproduce:
Import image with architecture named 'x64' (or presumably anything, since it's a freeform input), try to launch instance of image.

Expected Result:
Image launches, or if it cannot and error is needed, error should tell user there is an invalid architecture. If architecture can only be chosen from limited options, it should probably be a combobox rather than a freeform input when creating a new image.

Actual Result:
Generic API exception. Image fails to launch.

Revision history for this message
Matt Riedemann (mriedem) wrote :

I don't know what the Mirantis OpenStack UI is like, since that's a product, but to clarify something, do you already have an image with the invalid architecture uploaded to glance and you're trying to boot an instance from it? Or something else?

Matt Riedemann (mriedem)
tags: added: unified-objects
Revision history for this message
Matt Riedemann (mriedem) wrote :

The valid architectures for an image in nova are defined here:

https://github.com/openstack/nova/blob/13.0.0.0rc1/nova/compute/arch.py#L72

I've added Horizon to this bug report since Horizon could create a dropdown box using that list (although horizon might not be able to import that code and it's not available in the API/CLI, so it might just have to be copied into horizon and kept synchronized with nova).

For nova, we could do some image property validation for the architecture in the API so we could fail with a better error than what you get from the compute side when spawn fails.

Changed in nova:
status: New → Confirmed
importance: Undecided → Low
tags: added: api images
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/295395

Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
status: Confirmed → In Progress
Matt Riedemann (mriedem)
tags: added: liberty-backport-potential
Changed in nova:
importance: Low → Medium
tags: added: mitaka-backport-potential
Revision history for this message
Russell Holloway (russell-holloway) wrote :

To clarify, I already had an image uploaded with invalid architecture, and then when user tries to launch it they get the above message. Since users can upload images and fill in architecture themselves, and may be less familiar with components under the hood, better validation or alerts for glance / nova / horizon could be useful, since it doesn't seem there is validation on any of these components for architecture which can ultimately lead to the issue.

As for Mirantis, it's a vendor distribution but just uses all the same open source components from the ecosystem but pin to specific versions of components that are supposed to be stable together supposedly. The UI is horizon.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Russell, I have a fix up for the nova API validation part, I just need to write a functional test for it. If you could validate that patch resolves your issue it'd be helpful.

Changed in horizon:
status: New → Opinion
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 52b165bf1cf019353cd90b427ac3dd9991de48c7
Author: Matt Riedemann <email address hidden>
Date: Mon Mar 21 12:31:19 2016 -0400

    Return 400 on boot for invalid image metadata

    Horizon allows a free-form input field for architecture
    when creating an image. However, the architecture in
    the image metadata is validated against nova.compute.arch.ALL
    so when converting the image metadata in the compute API
    boot validation, if we hit a ValueError we should raise
    an appropriate exception so the REST API will return a 400
    rather than a 500.

    Change-Id: Ib01b4b088fec065c671f83f5912e928b4d7fec71
    Closes-Bug: #1558866

Changed in nova:
status: In Progress → Fix Released
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/303706

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

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

commit 1397faaa041b2c73050bb6225e14f31f3dd4c826
Author: Matt Riedemann <email address hidden>
Date: Mon Mar 21 12:31:19 2016 -0400

    Return 400 on boot for invalid image metadata

    Horizon allows a free-form input field for architecture
    when creating an image. However, the architecture in
    the image metadata is validated against nova.compute.arch.ALL
    so when converting the image metadata in the compute API
    boot validation, if we hit a ValueError we should raise
    an appropriate exception so the REST API will return a 400
    rather than a 500.

    Change-Id: Ib01b4b088fec065c671f83f5912e928b4d7fec71
    Closes-Bug: #1558866
    (cherry picked from commit 52b165bf1cf019353cd90b427ac3dd9991de48c7)

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

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/304750

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

Reviewed: https://review.openstack.org/304750
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4817f910bee28ba47abbcb3297bdafe3164de60e
Submitter: Jenkins
Branch: stable/liberty

commit 4817f910bee28ba47abbcb3297bdafe3164de60e
Author: Matt Riedemann <email address hidden>
Date: Mon Mar 21 12:31:19 2016 -0400

    Return 400 on boot for invalid image metadata

    Horizon allows a free-form input field for architecture
    when creating an image. However, the architecture in
    the image metadata is validated against nova.compute.arch.ALL
    so when converting the image metadata in the compute API
    boot validation, if we hit a ValueError we should raise
    an appropriate exception so the REST API will return a 400
    rather than a 500.

    Change-Id: Ib01b4b088fec065c671f83f5912e928b4d7fec71
    Closes-Bug: #1558866
    (cherry picked from commit 52b165bf1cf019353cd90b427ac3dd9991de48c7)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/nova 12.0.3

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

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/nova 14.0.0.0b1

This issue was fixed in the openstack/nova 14.0.0.0b1 development milestone.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 13.1.0

This issue was fixed in the openstack/nova 13.1.0 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.