Fields for statuses, formats, and other enums

Registered by Ryan Rossiter on 2015-12-15

Many fields used in cinder objects can be only one of a predefined set of values (such as a status, format, or type). These are usually held in objects as string fields that have no validation. The assignments and comparisons throughout the code on these fields also are hard-coded strings (thing.status == 'available'). Changing over these StringFields to become specified typed fields (relying on oslo.versionedobjects enums and fields), extra validation comes in at very little cost. These enums also become a centralized point of constants, and can be used throughout the code as replacements for the hard-coded strings (so now we have thing.status == fields.PossibleStatus.AVAILABLE).

Blueprint information

Status:
Not started
Approver:
Sean McGinnis
Priority:
Medium
Drafter:
Ryan Rossiter
Direction:
Approved
Assignee:
None
Definition:
Approved
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/cinder-object-fields,n,z

Addressed by: https://review.openstack.org/256737
    Add BackupStatus enum field

Addressed by: https://review.openstack.org/261068
    Add CGSnapshotStatus enum field

Addressed by: https://review.openstack.org/262054
    Add ConsistencyGroupStatus enum field

Addressed by: https://review.openstack.org/284825
    WIP: Add SnapshotStatus enum field

Addressed by: https://review.openstack.org/284816
    Tests: Don't assert on LOG.warn

Addressed by: https://review.openstack.org/290885
    Add VolumeAttachStatus Enum

Addressed by: https://review.openstack.org/313179
    Add ServiceTopic & ServiceDisabledReason Enum

Addressed by: https://review.openstack.org/322977
    Add ServiceBinary Enum

Addressed by: https://review.openstack.org/444734
    [WIP]Add VolumeStatus enum field

Addressed by: https://review.openstack.org/458318
    Add VolumeStatus enum field-Part(2)

Addressed by: https://review.openstack.org/479594
    Use GroupStatus enum field

Addressed by: https://review.openstack.org/479599
    Use SnapshotStatus enum field

Addressed by: https://review.openstack.org/479674
    Use QoSConsumerValues enum field

Addressed by: https://review.openstack.org/480206
    Use GroupSnapshotStatus enum field

Addressed by: https://review.openstack.org/563444
    Add missing VolumeAttachStatus enum field

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.