From af749d31078858ea0334825527fe7fc1673f0ef3 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Fri, 18 Nov 2022 09:40:26 -0500 Subject: [PATCH] Objects: Make OPTIONAL_FIELDS a tuple In some objects this is a list, in some it is a tuple. Just use tuples for consistency. Change-Id: I14871e2abd8680db72ab8e3d9ca873cb608e4039 --- cinder/objects/base.py | 2 +- cinder/objects/cgsnapshot.py | 2 +- cinder/objects/group.py | 2 +- cinder/objects/group_snapshot.py | 2 +- cinder/objects/group_type.py | 2 +- cinder/objects/qos_specs.py | 2 +- cinder/objects/volume_attachment.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cinder/objects/base.py b/cinder/objects/base.py index 0000735fd31..0b4f16ab7c3 100644 --- a/cinder/objects/base.py +++ b/cinder/objects/base.py @@ -246,7 +246,7 @@ class CinderPersistentObject(object): This adds the fields that we use in common for all persistent objects. """ - OPTIONAL_FIELDS = [] + OPTIONAL_FIELDS = () Not = db.Not Case = db.Case diff --git a/cinder/objects/cgsnapshot.py b/cinder/objects/cgsnapshot.py index 50dc667d3f1..5294292af17 100644 --- a/cinder/objects/cgsnapshot.py +++ b/cinder/objects/cgsnapshot.py @@ -28,7 +28,7 @@ class CGSnapshot(base.CinderPersistentObject, base.CinderObject, # Version 1.1: Added from_group_snapshot VERSION = '1.1' - OPTIONAL_FIELDS = ['consistencygroup', 'snapshots'] + OPTIONAL_FIELDS = ('consistencygroup', 'snapshots') # NOTE: When adding a field obj_make_compatible needs to be updated fields = { diff --git a/cinder/objects/group.py b/cinder/objects/group.py index dd9fb1136b7..3e42b5a0152 100644 --- a/cinder/objects/group.py +++ b/cinder/objects/group.py @@ -32,7 +32,7 @@ class Group(base.CinderPersistentObject, base.CinderObject, # Version 1.2: Added replication_status VERSION = '1.2' - OPTIONAL_FIELDS = ['volumes', 'volume_types', 'group_snapshots'] + OPTIONAL_FIELDS = ('volumes', 'volume_types', 'group_snapshots') # NOTE: When adding a field obj_make_compatible needs to be updated fields = { diff --git a/cinder/objects/group_snapshot.py b/cinder/objects/group_snapshot.py index 083c1be1c03..960ac9ec205 100644 --- a/cinder/objects/group_snapshot.py +++ b/cinder/objects/group_snapshot.py @@ -26,7 +26,7 @@ class GroupSnapshot(base.CinderPersistentObject, base.CinderObject, base.CinderObjectDictCompat, base.ClusteredObject): VERSION = '1.0' - OPTIONAL_FIELDS = ['group', 'snapshots'] + OPTIONAL_FIELDS = ('group', 'snapshots') # NOTE: When adding a field obj_make_compatible needs to be updated fields = { diff --git a/cinder/objects/group_type.py b/cinder/objects/group_type.py index a5fe61a8831..eb388dae596 100644 --- a/cinder/objects/group_type.py +++ b/cinder/objects/group_type.py @@ -27,7 +27,7 @@ class GroupType(base.CinderPersistentObject, base.CinderObject, # Version 1.0: Initial version VERSION = '1.0' - OPTIONAL_FIELDS = ['group_specs', 'projects'] + OPTIONAL_FIELDS = ('group_specs', 'projects') # NOTE: When adding a field obj_make_compatible needs to be updated fields = { diff --git a/cinder/objects/qos_specs.py b/cinder/objects/qos_specs.py index 9824983d087..182667d7b70 100644 --- a/cinder/objects/qos_specs.py +++ b/cinder/objects/qos_specs.py @@ -33,7 +33,7 @@ class QualityOfServiceSpecs(base.CinderPersistentObject, # 1.0: Initial version VERSION = "1.0" - OPTIONAL_FIELDS = ['volume_types'] + OPTIONAL_FIELDS = ('volume_types',) # NOTE: When adding a field obj_make_compatible needs to be updated fields = { diff --git a/cinder/objects/volume_attachment.py b/cinder/objects/volume_attachment.py index 52c6a4f67b7..b3769e2fa85 100644 --- a/cinder/objects/volume_attachment.py +++ b/cinder/objects/volume_attachment.py @@ -33,7 +33,7 @@ class VolumeAttachment(base.CinderPersistentObject, base.CinderObject, # Version 1.3: Added the connector attribute. VERSION = '1.3' - OPTIONAL_FIELDS = ['volume'] + OPTIONAL_FIELDS = ('volume',) obj_extra_fields = ['project_id', 'volume_host'] # NOTE: When adding a field obj_make_compatible needs to be updated