Objects should be using o.vo enums instead of status strings

Bug #1489136 reported by Ryan Rossiter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Magnum
Fix Released
Undecided
Cale Rath

Bug Description

I looks like statuses in https://github.com/openstack/magnum/blob/master/magnum/objects/bay.py and https://github.com/openstack/magnum/blob/master/magnum/objects/container.py are basically enums, but within the actual versioned objects themselves, they are held as a StringField. oslo.versionedobjects has an Enum object (https://github.com/openstack/oslo.versionedobjects/blob/master/oslo_versionedobjects/fields.py#L268) and an EnumField object (https://github.com/openstack/oslo.versionedobjects/blob/master/oslo_versionedobjects/fields.py#L586) that are created specifically for these situations.

Here's an example of how nova uses an Enum field for block device stuff (https://github.com/openstack/nova/blob/master/nova/objects/fields.py#L101) and the statuses here should be done and tested in the same way. Enum test examples for nova are here (https://github.com/openstack/nova/blob/master/nova/tests/unit/objects/test_fields.py). Seeing as there is no test_fields for Magnum, that will have to be added.

Changed in magnum:
assignee: nobody → Vilobh Meshram (vilobhmm)
assignee: Vilobh Meshram (vilobhmm) → nobody
Cale Rath (ctrath)
Changed in magnum:
assignee: nobody → Cale Rath (ctrath)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to magnum (master)

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

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

Reviewed: https://review.openstack.org/217399
Committed: https://git.openstack.org/cgit/openstack/magnum/commit/?id=e4add16a69a28b8240b09316be292a68870c85b2
Submitter: Jenkins
Branch: master

commit e4add16a69a28b8240b09316be292a68870c85b2
Author: Cale Rath <email address hidden>
Date: Wed Aug 26 20:18:10 2015 +0000

    Use oslo.versionedobjects enums instead of status strings

    Statuses are currently defined as a StringField when they should
    be defined as an Enum object. This fix changes these objects from
    using StringField by extending the Enum object in
    oslo.versionedobjects

    Change-Id: I12760e1d72f4af9931ee97bbad298f92f785118f
    Partial-Bug: #1489136

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

Reviewed: https://review.openstack.org/217405
Committed: https://git.openstack.org/cgit/openstack/magnum/commit/?id=5ac2dce563d4e5ebacb65acfebee4f3fb9cfeaf1
Submitter: Jenkins
Branch: master

commit 5ac2dce563d4e5ebacb65acfebee4f3fb9cfeaf1
Author: Ryan Rossiter <email address hidden>
Date: Wed Aug 26 21:44:39 2015 +0000

    Add field for container status

    This adds an enum for the different statuses and changes over to use
    those constants in docker conducter.

    An UNKNOWN value was also added because the API tests expected 'Unknown'
    so this value needed to be added to the field in order to be valid.

    Change-Id: Ic79317f0fbdaf99c1979d3023f04c4eba44b412a
    Closes-Bug: #1489136

Changed in magnum:
status: In Progress → Fix Committed
Adrian Otto (aotto)
Changed in magnum:
milestone: none → mitaka-1
status: Fix Committed → Fix Released
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.