PCI Device object improperly ignores missing db_object fields

Bug #1221360 reported by Dan Smith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Dan Smith

Bug Description

In PCIDevice._from_db_object():

  pci_device[key] = db_dev.get(key)

This makes the method ignore missing database object keys, which prevents the strict typechecking from doing it's job, and differs from every other object model currently in the tree. As a result, non-nullable attributes such as dev_type are string-converted to "None" in the object, which is definitely not the intent.

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/45297
Committed: http://github.com/openstack/nova/commit/72ea0b76657a0f574ae6b17617ac560f2dbde0d9
Submitter: Jenkins
Branch: master

commit 72ea0b76657a0f574ae6b17617ac560f2dbde0d9
Author: Dan Smith <email address hidden>
Date: Thu Sep 5 10:41:57 2013 -0700

    Fix PCIDevice ignoring missing DB attributes

    Right now, the PCIDevice _from_db_object() method ignores missing
    attributes on the DB object by using get(). This prevents the strict
    typechecking from doing it's job, and differs from every other object
    model currently in the tree. As a result, non-nullable attributes such
    as dev_type are string-converted to "None" in the object, which is
    definitely not the intent.

    This is convention, not something we test for, but it was wrong, and
    ended up breaking the next patch which introduces a scenario where this
    gets checked in the unit tests more strictly. Thus, the test is in the
    next aptch

    Change-Id: Id6e1f444ceae13ee9fa1a9518db5a239a1d9fbe3
    Closes-bug: 1221360

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: havana-rc1 → 2013.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.