HTTP 500 returned if a string is specified for delete_on_termination during boot from volume

Bug #1060955 reported by Rohit Karajgi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Unmesh Gurjar
Folsom
Fix Released
Low
Joe Gordon

Bug Description

Pass a string, other than 'True' or 'False' for the <delete_on_terminate> flag placeholder while booting from volume.

$ nova boot --flavor 1 --image a2bfa0c3-fb77-4da3-9a45-c0ed0debb1d5 --block_device_mapping vda=fbd8ae99-2aaf-4c88-83bb-9341c28f1174:volume::just_a_string SERVER_BOOTED_FROM_VOLUME
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-731d5d89-4b51-4c64-bf0d-a1de3e2f21e8)

Stack trace (n-api):

2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 859, in create
2012-10-03 06:31:19 TRACE nova.api.openstack scheduler_hints=scheduler_hints)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 784, in create
2012-10-03 06:31:19 TRACE nova.api.openstack scheduler_hints=scheduler_hints)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 516, in _create_instance
2012-10-03 06:31:19 TRACE nova.api.openstack QUOTAS.rollback(context, quota_reservations)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2012-10-03 06:31:19 TRACE nova.api.openstack self.gen.next()
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 505, in _create_instance
2012-10-03 06:31:19 TRACE nova.api.openstack security_group, block_device_mapping)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 729, in create_db_entry_for_new_instance
2012-10-03 06:31:19 TRACE nova.api.openstack instance_type, image, block_device_mapping)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 640, in _populate_instance_for_bdm
2012-10-03 06:31:19 TRACE nova.api.openstack instance_type, instance_uuid, mapping)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 621, in _update_block_device_mapping
2012-10-03 06:31:19 TRACE nova.api.openstack values)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/db/api.py", line 1219, in block_device_mapping_update_or_create
2012-10-03 06:31:19 TRACE nova.api.openstack return IMPL.block_device_mapping_update_or_create(context, values)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 129, in wrapper
2012-10-03 06:31:19 TRACE nova.api.openstack return f(*args, **kwargs)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 3334, in block_device_mapping_update_or_create
2012-10-03 06:31:19 TRACE nova.api.openstack bdm_ref.save(session=session)
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/db/sqlalchemy/models.py", line 56, in save
2012-10-03 06:31:19 TRACE nova.api.openstack session.flush()
2012-10-03 06:31:19 TRACE nova.api.openstack File "/opt/stack/nova/nova/exception.py", line 73, in _wrap
2012-10-03 06:31:19 TRACE nova.api.openstack raise DBError(e)
2012-10-03 06:31:19 TRACE nova.api.openstack DBError: invalid literal for int() with base 10: 'test_boot' (original cause: ValueError: invalid literal for int() with base 10: 'test_boot') 'INSERT INTO block_device_mapping (created_at, updated_at, deleted_at, deleted, instance_uuid, device_name, delete_on_termination, virtual_name, snapshot_id, volume_id, volume_size, no_device, connection_info) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' [{'instance_uuid': 'a7586028-a701-4a8a-a9ff-86fb5ef5ceb4', 'virtual_name': None, 'no_device': None, 'connection_info': None, 'volume_id': u'fbd8ae99-2aaf-4c88-83bb-9341c28f1174', 'updated_at': None, 'device_name': u'vda', 'volume_size': u'', 'snapshot_id': None, 'deleted_at': None, 'delete_on_termination': u'just_a_string'}]
2012-10-03 06:31:19 TRACE nova.api.openstack
2012-10-03 06:31:19 INFO nova.api.openstack [req-731d5d89-4b51-4c64-bf0d-a1de3e2f21e8 admin admin] http://10.2.3.102:8774/v2/b1519b1ea6b8439fb7d88b1ec79ceec2/os-volumes_boot returned with HTTP 500

The parameter should accept only Boolean (True/1 or False/0)

Tags: ntt
Revision history for this message
Rohit Karajgi (rohitk) wrote :

The above request should return an HTTP Bad Request instead.

Changed in nova:
assignee: nobody → Chetan Kumar (chetan-kumar)
Rohit Karajgi (rohitk)
description: updated
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/14377

Changed in nova:
assignee: Chetan Kumar (chetan-kumar) → Unmesh Gurjar (unmesh-gurjar)
status: New → In Progress
Changed in nova:
importance: Undecided → Low
tags: added: folsom-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/14377
Committed: http://github.com/openstack/nova/commit/7c9761b3bb52788021b5bf0eb9726af833db4074
Submitter: Jenkins
Branch: master

commit 7c9761b3bb52788021b5bf0eb9726af833db4074
Author: Unmesh Gurjar <email address hidden>
Date: Thu Oct 11 23:48:08 2012 -0700

    Fix error on invalid delete_on_termination value

    1. Fixed 500 error when an invalid value is passed to 'delete_on_termination'
    parameter in 'block_device_mapping' of create server API (json request).
    Converted the value to 'bool' (similar to XML request workflow) to fix issue.
    2. Also added unit test coverage.

    Fixes LP: #1060955

    Change-Id: Ib35040f17a3712dac45ec1e3c2f32fee17db7c03

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/16664

Joe Gordon (jogo)
tags: removed: folsom-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/folsom)

Reviewed: https://review.openstack.org/16664
Committed: http://github.com/openstack/nova/commit/42a85c08d6a3e005a800b6c3f61d42dc8a26b1bb
Submitter: Jenkins
Branch: stable/folsom

commit 42a85c08d6a3e005a800b6c3f61d42dc8a26b1bb
Author: Unmesh Gurjar <email address hidden>
Date: Thu Oct 11 23:48:08 2012 -0700

    Fix error on invalid delete_on_termination value

    1. Fixed 500 error when an invalid value is passed to 'delete_on_termination'
    parameter in 'block_device_mapping' of create server API (json request).
    Converted the value to 'bool' (similar to XML request workflow) to fix issue.
    2. Also added unit test coverage.

    Fixes LP: #1060955

    Change-Id: Ib35040f17a3712dac45ec1e3c2f32fee17db7c03
    (cherry picked from commit 7c9761b3bb52788021b5bf0eb9726af833db4074)

Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-1 → 2013.1
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.