From: Thang Pham Date: Wed, 25 Mar 2015 14:54:23 +0000 (-0400) Subject: Sort list of cinder_object.changes X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=32d70f493a42bb0525113bcbe88c1ecf96a24cea;p=openstack-build%2Fcinder-build.git Sort list of cinder_object.changes If PYTHONHASHSEED is set to a non-zero value, test_objects.TestObject.test_base_attributes unit test fails. This is because 'cinder_object.changes' key is an unsorted list when the object is converted to a primitive. The following patch fixes this by sorting cinder_object.changes. Change-Id: I3a80396c5c897de26e982fa6426e7720a09c1375 Closes-Bug: #1434154 --- diff --git a/cinder/objects/base.py b/cinder/objects/base.py index 38cd679b8..23d66322b 100644 --- a/cinder/objects/base.py +++ b/cinder/objects/base.py @@ -482,7 +482,7 @@ class CinderObject(object): 'cinder_object.version': target_version or self.VERSION, 'cinder_object.data': primitive} if self.obj_what_changed(): - obj['cinder_object.changes'] = list(self.obj_what_changed()) + obj['cinder_object.changes'] = sorted(self.obj_what_changed()) return obj def obj_set_defaults(self, *attrs): diff --git a/cinder/tests/objects/test_objects.py b/cinder/tests/objects/test_objects.py index 2758dba34..6fe798886 100644 --- a/cinder/tests/objects/test_objects.py +++ b/cinder/tests/objects/test_objects.py @@ -578,7 +578,7 @@ class _TestObject(object): 'cinder_object.namespace': 'cinder', 'cinder_object.version': '1.6', 'cinder_object.changes': - ['deleted', 'created_at', 'deleted_at', 'updated_at'], + ['created_at', 'deleted', 'deleted_at', 'updated_at'], 'cinder_object.data': {'created_at': timeutils.isotime(dt), 'updated_at': timeutils.isotime(dt),