nova.virt.block_device.get_swap should have better safeguards

Bug #1214406 reported by Nikola Đipanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Ana Krivokapić

Bug Description

As per markmc's comments on https://review.openstack.org/#/c/39086/24 - the function is used to get the swap out of the list context as the block_device_info data structure (used internally by the virt drivers) needs 'swap' field to be either a single dict or none. However if passed something that is not an obvious list of swap looking things - the function will happily reutrn the passed list.

More safe and correct behaviour would be to return None (or raise).

Changed in nova:
milestone: none → havana-3
importance: Undecided → Low
assignee: nobody → Nikola Đipanov (ndipanov)
tags: added: low-hanging-fruit
Changed in nova:
status: New → In Progress
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → havana-rc1
Changed in nova:
milestone: havana-rc1 → none
Revision history for this message
Sean Dague (sdague) wrote :

nikola, is this still an issue? or have other cleanups addressed it. Please move to confirmed if still an issue or Invalid if you think it's fixed.

Changed in nova:
status: In Progress → Incomplete
assignee: Nikola Đipanov (ndipanov) → nobody
Revision history for this message
Nikola Đipanov (ndipanov) wrote :

Hmmm seems like it's not fixed yet - will post something very soon as it's a trivial fix really.

Changed in nova:
status: Incomplete → Confirmed
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/122440

Changed in nova:
assignee: nobody → Ana Krivokapić (akrivoka)
status: Confirmed → In Progress
Changed in nova:
milestone: none → juno-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 0efbcf4e168d030907adbadd6ab7fccf766f4068
Author: Ana Krivokapic <email address hidden>
Date: Thu Sep 18 16:37:46 2014 +0200

    Return None from get_swap() if input is not swap

    If a non-swap parameter is passed to get_swap(), return None,
    rather than returning the parameter itself.

    Change-Id: Icfb0eb0e4d721522160d0b7a4fd9b98c1871a10a
    Closes-bug: #1214406

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-rc1 → 2014.2
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.