Remove IN_USE from ConsistencyGroupStatus enum

It seems that we've added IN_USE as a valid CG status, which actually
isn't valid. It is used only in tests. This commit removes it from the
enum and replaces occurrences in tests with equivalent valid statuses.

As CG should not ever get that status in runtime, no new version of the
object or compatibility routine is added.

TrivialFix

Change-Id: Id8290e73a38a941a2a84391ded6ddbcb87be411e
This commit is contained in:
Michał Dulko 2016-06-03 15:48:17 +02:00
parent 7213086164
commit 7369aaee2a
4 changed files with 6 additions and 8 deletions

View File

@ -50,11 +50,10 @@ class ConsistencyGroupStatus(Enum):
DELETING = 'deleting'
DELETED = 'deleted'
UPDATING = 'updating'
IN_USE = 'in-use'
ERROR_DELETING = 'error_deleting'
ALL = (ERROR, AVAILABLE, CREATING, DELETING, DELETED,
UPDATING, IN_USE, ERROR_DELETING)
UPDATING, ERROR_DELETING)
def __init__(self):
super(ConsistencyGroupStatus, self).__init__(

View File

@ -501,15 +501,15 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
fake.WILL_NOT_BE_FOUND_ID,
res_dict['itemNotFound']['message'])
def test_delete_consistencygroup_with_Invalidconsistencygroup(self):
def test_delete_consistencygroup_with_invalid_consistencygroup(self):
consistencygroup = self._create_consistencygroup(
status=fields.ConsistencyGroupStatus.IN_USE)
status=fields.ConsistencyGroupStatus.CREATING)
self._assert_deleting_result_400(consistencygroup.id)
consistencygroup.destroy()
def test_delete_consistencygroup_invalid_force(self):
consistencygroup = self._create_consistencygroup(
status=fields.ConsistencyGroupStatus.IN_USE)
status=fields.ConsistencyGroupStatus.CREATING)
req = webob.Request.blank('/v2/%s/consistencygroups/%s/delete' %
(fake.PROJECT_ID, consistencygroup.id))
req.method = 'POST'
@ -1080,7 +1080,7 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
def test_update_consistencygroup_invalid_state(self):
consistencygroup = self._create_consistencygroup(
status=fields.ConsistencyGroupStatus.IN_USE,
status=fields.ConsistencyGroupStatus.CREATING,
ctxt=self.ctxt)
req = webob.Request.blank('/v2/%s/consistencygroups/%s/update' %
(fake.PROJECT_ID, consistencygroup.id))

View File

@ -94,7 +94,6 @@ class TestConsistencyGroupStatus(TestField):
('deleting', 'deleting'),
('deleted', 'deleted'),
('updating', 'updating'),
('in-use', 'in-use'),
('error_deleting', 'error_deleting')]
self.coerce_bad_values = ['acme']
self.to_primitive_values = self.coerce_good_values[0:1]

View File

@ -28,7 +28,7 @@ object_data = {
'BackupList': '1.0-24591dabe26d920ce0756fe64cd5f3aa',
'CGSnapshot': '1.0-de2586a31264d7647f40c762dece9d58',
'CGSnapshotList': '1.0-e8c3f4078cd0ee23487b34d173eec776',
'ConsistencyGroup': '1.2-dff0647c77d1b34682c7b3af7b50588e',
'ConsistencyGroup': '1.2-de280886bd04d7e3184c1f7c3a7e2074',
'ConsistencyGroupList': '1.1-73916823b697dfa0c7f02508d87e0f28',
'Service': '1.3-66c8e1683f58546c54551e9ff0a3b111',
'ServiceList': '1.1-cb758b200f0a3a90efabfc5aa2ffb627',