)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5292,"name":"Christopher Yeoh","email":"cbkyeoh@gmail.com","username":"cyeoh-0"},"change_message_id":"d80a64eecc9dacdfeadcacb4a0c9e1f587dbe620","unresolved":false,"context_lines":[{"line_number":23,"context_line":"task in nova-compute service to delete those instances, for which"},{"line_number":24,"context_line":"task_state is in \u0027deleting\u0027."},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"Closes Bug: 1308342"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"Change-Id: I4d0e47662a80109ef9622d85455587d487e47c01"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"fa98f980_f5ec12be","line":26,"updated":"2014-09-16 11:07:18.000000000","message":"This should be \u0027Closes-Bug: 1308342\u0027 as the tools won\u0027t recognise it otherwise","commit_id":"c3bd66e06a45f5d55a5e7da7a6a91d55f344101a"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8f261eb82247241c1b5d7427b3a980820cbb6df7","unresolved":false,"context_lines":[{"line_number":22,"context_line":"To avoid restarting the nova-compute service manually, added periodic"},{"line_number":23,"context_line":"task in nova-compute service to delete those instances, for which"},{"line_number":24,"context_line":"task_state is in \u0027deleting\u0027."},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"Closes-Bug: 1308342"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"Change-Id: I4d0e47662a80109ef9622d85455587d487e47c01"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"fa98f980_ee242362","line":25,"updated":"2014-09-17 08:17:20.000000000","message":"this is missing a DocImpact flag describing the new configuration variable.","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"}],"nova/compute/api.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"cd9a5ebd4fb4c5a7cd6ee8964eb4ce3d2752edf0","unresolved":false,"context_lines":[{"line_number":1584,"context_line":"                if self.servicegroup_api.service_is_up(service):"},{"line_number":1585,"context_line":"                    is_up \u003d True"},{"line_number":1586,"context_line":""},{"line_number":1587,"context_line":"                    if (delete_type !\u003d \u0027force_delete\u0027"},{"line_number":1588,"context_line":"                            and original_task_state in ("},{"line_number":1589,"context_line":"                            task_states.DELETING,"},{"line_number":1590,"context_line":"                            task_states.SOFT_DELETING)):"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_94452f19","line":1587,"updated":"2014-09-24 06:22:59.000000000","message":"it would be good if the delete type could be defines, similar to the task states","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"},{"author":{"_account_id":10795,"name":"Rajesh Tailor","email":"tailor.rajesh88@gmail.com","username":"rajeshtailor"},"change_message_id":"56475fe9b39863c322d4aed2c2eb5ca8eb908547","unresolved":false,"context_lines":[{"line_number":1584,"context_line":"                if self.servicegroup_api.service_is_up(service):"},{"line_number":1585,"context_line":"                    is_up \u003d True"},{"line_number":1586,"context_line":""},{"line_number":1587,"context_line":"                    if (delete_type !\u003d \u0027force_delete\u0027"},{"line_number":1588,"context_line":"                            and original_task_state in ("},{"line_number":1589,"context_line":"                            task_states.DELETING,"},{"line_number":1590,"context_line":"                            task_states.SOFT_DELETING)):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_6148402e","line":1587,"in_reply_to":"da9df570_94452f19","updated":"2014-09-30 09:54:56.000000000","message":"Hi garyk,\n\nI have checked the code and since delete_types (\u0027soft_delete\u0027, \u0027delete\u0027 and \u0027force_delete\u0027) are used at several places, IMO it would be better to address this as a separate patch.\n\nPlease give your suggestion for the same.","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"},{"author":{"_account_id":5292,"name":"Christopher Yeoh","email":"cbkyeoh@gmail.com","username":"cyeoh-0"},"change_message_id":"f330888fdd20594b2f25db5ce2c8a92bbf66b0c8","unresolved":false,"context_lines":[{"line_number":1584,"context_line":"                if self.servicegroup_api.service_is_up(service):"},{"line_number":1585,"context_line":"                    is_up \u003d True"},{"line_number":1586,"context_line":""},{"line_number":1587,"context_line":"                    if (delete_type !\u003d \u0027force_delete\u0027"},{"line_number":1588,"context_line":"                            and original_task_state in ("},{"line_number":1589,"context_line":"                            task_states.DELETING,"},{"line_number":1590,"context_line":"                            task_states.SOFT_DELETING)):"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_853b3637","line":1587,"in_reply_to":"da9df570_94452f19","updated":"2014-09-24 10:00:30.000000000","message":"I agree","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"cd9a5ebd4fb4c5a7cd6ee8964eb4ce3d2752edf0","unresolved":false,"context_lines":[{"line_number":1824,"context_line":""},{"line_number":1825,"context_line":"    @wrap_check_policy"},{"line_number":1826,"context_line":"    @check_instance_lock"},{"line_number":1827,"context_line":"    @check_instance_state(task_state\u003dNone,"},{"line_number":1828,"context_line":"                          must_have_launched\u003dFalse)"},{"line_number":1829,"context_line":"    def force_delete(self, context, instance):"},{"line_number":1830,"context_line":"        \"\"\"Force delete an instance in any vm_state/task_state.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_94136f0c","line":1827,"updated":"2014-09-24 06:22:59.000000000","message":"can you please clarify why this is set to None here?","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"},{"author":{"_account_id":5292,"name":"Christopher Yeoh","email":"cbkyeoh@gmail.com","username":"cyeoh-0"},"change_message_id":"f330888fdd20594b2f25db5ce2c8a92bbf66b0c8","unresolved":false,"context_lines":[{"line_number":1824,"context_line":""},{"line_number":1825,"context_line":"    @wrap_check_policy"},{"line_number":1826,"context_line":"    @check_instance_lock"},{"line_number":1827,"context_line":"    @check_instance_state(task_state\u003dNone,"},{"line_number":1828,"context_line":"                          must_have_launched\u003dFalse)"},{"line_number":1829,"context_line":"    def force_delete(self, context, instance):"},{"line_number":1830,"context_line":"        \"\"\"Force delete an instance in any vm_state/task_state.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_a5783af3","line":1827,"in_reply_to":"da9df570_94136f0c","updated":"2014-09-24 10:00:30.000000000","message":"The default is (None,) which means that only a task_state of None is acceptable for check_instance_state. Whereas a task_state of None for the parameter means that any task state is ok.","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"cd9a5ebd4fb4c5a7cd6ee8964eb4ce3d2752edf0","unresolved":false,"context_lines":[{"line_number":1828,"context_line":"                          must_have_launched\u003dFalse)"},{"line_number":1829,"context_line":"    def force_delete(self, context, instance):"},{"line_number":1830,"context_line":"        \"\"\"Force delete an instance in any vm_state/task_state.\"\"\""},{"line_number":1831,"context_line":"        self._delete_instance(context, instance, \u0027force_delete\u0027)"},{"line_number":1832,"context_line":""},{"line_number":1833,"context_line":"    def force_stop(self, context, instance, do_cast\u003dTrue):"},{"line_number":1834,"context_line":"        LOG.debug(\"Going to try to stop instance\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_d4f417d1","line":1831,"updated":"2014-09-24 06:22:59.000000000","message":"this will change exiting behavior? right?","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"},{"author":{"_account_id":10795,"name":"Rajesh Tailor","email":"tailor.rajesh88@gmail.com","username":"rajeshtailor"},"change_message_id":"ff7578614da49d4ef9734882871e7569484dcd85","unresolved":false,"context_lines":[{"line_number":1828,"context_line":"                          must_have_launched\u003dFalse)"},{"line_number":1829,"context_line":"    def force_delete(self, context, instance):"},{"line_number":1830,"context_line":"        \"\"\"Force delete an instance in any vm_state/task_state.\"\"\""},{"line_number":1831,"context_line":"        self._delete_instance(context, instance, \u0027force_delete\u0027)"},{"line_number":1832,"context_line":""},{"line_number":1833,"context_line":"    def force_stop(self, context, instance, do_cast\u003dTrue):"},{"line_number":1834,"context_line":"        LOG.debug(\"Going to try to stop instance\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_107122e0","line":1831,"in_reply_to":"da9df570_d4f417d1","updated":"2014-09-25 14:31:06.000000000","message":"Hi garyk,\n\nThis won\u0027t change much, but since the delete_type is changed,\nthe event_type will also change to \u0027force_delete.start\u0027 and \u0027force_delete.end\u0027. While monitoring for event types, need to monitor this new event-type also.","commit_id":"1d27a4bcacd68de548c1624d9af863de39b9a6b8"}],"nova/compute/cells_api.py":[{"author":{"_account_id":5292,"name":"Christopher Yeoh","email":"cbkyeoh@gmail.com","username":"cyeoh-0"},"change_message_id":"3fd59434b55e9d5bac2c28e49d28f2b29c68898f","unresolved":false,"context_lines":[{"line_number":231,"context_line":"    def delete(self, context, instance):"},{"line_number":232,"context_line":"        self._handle_cell_delete(context, instance, delete_types.DELETE)"},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"    def _handle_cell_delete(self, context, instance, method_name):"},{"line_number":235,"context_line":"        if not instance[\u0027cell_name\u0027]:"},{"line_number":236,"context_line":"            if method_name \u003d\u003d delete_types.SOFT_DELETE:"},{"line_number":237,"context_line":"                delete_type \u003d delete_types.SOFT_DELETE"}],"source_content_type":"text/x-python","patch_set":8,"id":"baa201ad_2aa09742","line":234,"updated":"2014-10-14 01:14:53.000000000","message":"this parameter is no longer a method name","commit_id":"e18259b19d81b93efed6745f032560f57fec15d6"},{"author":{"_account_id":5292,"name":"Christopher Yeoh","email":"cbkyeoh@gmail.com","username":"cyeoh-0"},"change_message_id":"3fd59434b55e9d5bac2c28e49d28f2b29c68898f","unresolved":false,"context_lines":[{"line_number":236,"context_line":"            if method_name \u003d\u003d delete_types.SOFT_DELETE:"},{"line_number":237,"context_line":"                delete_type \u003d delete_types.SOFT_DELETE"},{"line_number":238,"context_line":"            else:"},{"line_number":239,"context_line":"                delete_type \u003d delete_types.DELETE"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"            self.cells_rpcapi.instance_delete_everywhere(context,"},{"line_number":242,"context_line":"                    instance, delete_type)"}],"source_content_type":"text/x-python","patch_set":8,"id":"baa201ad_0ac033df","line":239,"updated":"2014-10-14 01:14:53.000000000","message":"I don\u0027t understand why you need this given the callers of the method pass SOFT_DELETE or DELETE now","commit_id":"e18259b19d81b93efed6745f032560f57fec15d6"}],"nova/compute/delete_types.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"72217cf55a62897b7f44cd3f589a9d611082f497","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2014 OpenStack Foundation"},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_2277fa3b","line":1,"updated":"2014-10-01 12:20:49.000000000","message":"i do not think that you need to change this","commit_id":"4185550106777267f16c1e200c7146a09608f4b9"}],"nova/compute/manager.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8f261eb82247241c1b5d7427b3a980820cbb6df7","unresolved":false,"context_lines":[{"line_number":5955,"context_line":""},{"line_number":5956,"context_line":"        for instance in deleting_insts:"},{"line_number":5957,"context_line":"            if timeutils.is_older_than(instance[\u0027updated_at\u0027], timeout):"},{"line_number":5958,"context_line":"                try:"},{"line_number":5959,"context_line":"                    LOG.info(_(\u0027Service started deleting the instance during \u0027"},{"line_number":5960,"context_line":"                               \u0027the previous run, but did not finish. \u0027"},{"line_number":5961,"context_line":"                               \u0027Restarting the deletion now.\u0027),"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_eee503dd","line":5958,"updated":"2014-09-17 08:17:20.000000000","message":"this whole code chunk feels like it should make use of _complete_partial_deletion or _complete_deletion\n\nI also feelt hat there may be races if a number of compute nodex invoke the code - maybe you should consider this per host.","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":10795,"name":"Rajesh Tailor","email":"tailor.rajesh88@gmail.com","username":"rajeshtailor"},"change_message_id":"16da2b4e46a94d79bc5ff9f8d480492063f8e1d9","unresolved":false,"context_lines":[{"line_number":5955,"context_line":""},{"line_number":5956,"context_line":"        for instance in deleting_insts:"},{"line_number":5957,"context_line":"            if timeutils.is_older_than(instance[\u0027updated_at\u0027], timeout):"},{"line_number":5958,"context_line":"                try:"},{"line_number":5959,"context_line":"                    LOG.info(_(\u0027Service started deleting the instance during \u0027"},{"line_number":5960,"context_line":"                               \u0027the previous run, but did not finish. \u0027"},{"line_number":5961,"context_line":"                               \u0027Restarting the deletion now.\u0027),"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_922d5fab","line":5958,"in_reply_to":"fa98f980_eee503dd","updated":"2014-09-18 07:23:19.000000000","message":"Hi garyk,\n\n1) I have tested using _complete_partial_deletion, but it works only when vm_state is marked as \u0027deleted\u0027.\n\nIn case if task_state is \u0027deleting\u0027, then it doesn\u0027t update task_state to None in db, after instance deletion.\n\nThen in subsequent periodic task run, it throws the error InstanceNotFound (because that instance is already deleted, but the task_state is still \u0027deleting\u0027).\n\n2) I have already filtered instances based on per host.\npls have a look at filters dict.\n\nfilters \u003d {\u0027task_state\u0027: task_states.DELETING, \u0027host\u0027: self.host}","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6b4ee37e865f4784acec554cc4a4ca6f29cf998f","unresolved":false,"context_lines":[{"line_number":5959,"context_line":"                    LOG.info(_(\u0027Service started deleting the instance during \u0027"},{"line_number":5960,"context_line":"                               \u0027the previous run, but did not finish. \u0027"},{"line_number":5961,"context_line":"                               \u0027Restarting the deletion now.\u0027),"},{"line_number":5962,"context_line":"                             instance\u003dinstance)"},{"line_number":5963,"context_line":""},{"line_number":5964,"context_line":"                    instance.obj_load_attr(\u0027metadata\u0027)"},{"line_number":5965,"context_line":"                    instance.obj_load_attr(\u0027system_metadata\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_95090635","line":5962,"updated":"2014-09-16 11:24:02.000000000","message":"_LI","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":10795,"name":"Rajesh Tailor","email":"tailor.rajesh88@gmail.com","username":"rajeshtailor"},"change_message_id":"16da2b4e46a94d79bc5ff9f8d480492063f8e1d9","unresolved":false,"context_lines":[{"line_number":5959,"context_line":"                    LOG.info(_(\u0027Service started deleting the instance during \u0027"},{"line_number":5960,"context_line":"                               \u0027the previous run, but did not finish. \u0027"},{"line_number":5961,"context_line":"                               \u0027Restarting the deletion now.\u0027),"},{"line_number":5962,"context_line":"                             instance\u003dinstance)"},{"line_number":5963,"context_line":""},{"line_number":5964,"context_line":"                    instance.obj_load_attr(\u0027metadata\u0027)"},{"line_number":5965,"context_line":"                    instance.obj_load_attr(\u0027system_metadata\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_9291dff3","line":5962,"in_reply_to":"fa98f980_95090635","updated":"2014-09-18 07:23:19.000000000","message":"Done","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6b4ee37e865f4784acec554cc4a4ca6f29cf998f","unresolved":false,"context_lines":[{"line_number":5979,"context_line":"                                   cores\u003d-instance_vcpus,"},{"line_number":5980,"context_line":"                                   ram\u003d-instance_memory_mb)"},{"line_number":5981,"context_line":"                    self._delete_instance(context, instance, bdm, quotas)"},{"line_number":5982,"context_line":"                except Exception as e:"},{"line_number":5983,"context_line":"                    # we don\u0027t want that an exception blocks it."},{"line_number":5984,"context_line":"                    msg \u003d _LE(\u0027Failed to complete a deletion : %s \u0027)\\"},{"line_number":5985,"context_line":"                          % unicode(e)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_f817a943","line":5982,"updated":"2014-09-16 11:24:02.000000000","message":"Hmm I understand it\u0027s needed but it may be hidding problems here no? For example: That get_by_instance_uuid() can\u0027t it raise NotFound or something?\n\nI would try to make this try...except block smaller or at least handle other types of exceptions that may be raised there.","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":10795,"name":"Rajesh Tailor","email":"tailor.rajesh88@gmail.com","username":"rajeshtailor"},"change_message_id":"16da2b4e46a94d79bc5ff9f8d480492063f8e1d9","unresolved":false,"context_lines":[{"line_number":5979,"context_line":"                                   cores\u003d-instance_vcpus,"},{"line_number":5980,"context_line":"                                   ram\u003d-instance_memory_mb)"},{"line_number":5981,"context_line":"                    self._delete_instance(context, instance, bdm, quotas)"},{"line_number":5982,"context_line":"                except Exception as e:"},{"line_number":5983,"context_line":"                    # we don\u0027t want that an exception blocks it."},{"line_number":5984,"context_line":"                    msg \u003d _LE(\u0027Failed to complete a deletion : %s \u0027)\\"},{"line_number":5985,"context_line":"                          % unicode(e)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_d2ba8770","line":5982,"in_reply_to":"fa98f980_f817a943","updated":"2014-09-18 07:23:19.000000000","message":"Done","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8f261eb82247241c1b5d7427b3a980820cbb6df7","unresolved":false,"context_lines":[{"line_number":5981,"context_line":"                    self._delete_instance(context, instance, bdm, quotas)"},{"line_number":5982,"context_line":"                except Exception as e:"},{"line_number":5983,"context_line":"                    # we don\u0027t want that an exception blocks it."},{"line_number":5984,"context_line":"                    msg \u003d _LE(\u0027Failed to complete a deletion : %s \u0027)\\"},{"line_number":5985,"context_line":"                          % unicode(e)"},{"line_number":5986,"context_line":"                    LOG.exception(msg, instance\u003dinstance)"},{"line_number":5987,"context_line":"                    self._set_instance_error_state(context, instance)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_0e13270e","line":5984,"updated":"2014-09-17 08:17:20.000000000","message":"can you please refrain from using \\","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"},{"author":{"_account_id":10795,"name":"Rajesh Tailor","email":"tailor.rajesh88@gmail.com","username":"rajeshtailor"},"change_message_id":"16da2b4e46a94d79bc5ff9f8d480492063f8e1d9","unresolved":false,"context_lines":[{"line_number":5981,"context_line":"                    self._delete_instance(context, instance, bdm, quotas)"},{"line_number":5982,"context_line":"                except Exception as e:"},{"line_number":5983,"context_line":"                    # we don\u0027t want that an exception blocks it."},{"line_number":5984,"context_line":"                    msg \u003d _LE(\u0027Failed to complete a deletion : %s \u0027)\\"},{"line_number":5985,"context_line":"                          % unicode(e)"},{"line_number":5986,"context_line":"                    LOG.exception(msg, instance\u003dinstance)"},{"line_number":5987,"context_line":"                    self._set_instance_error_state(context, instance)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_b28ee3ce","line":5984,"in_reply_to":"fa98f980_0e13270e","updated":"2014-09-18 07:23:19.000000000","message":"Done","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"}],"nova/tests/compute/test_compute_mgr.py":[{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6b4ee37e865f4784acec554cc4a4ca6f29cf998f","unresolved":false,"context_lines":[{"line_number":1911,"context_line":"            self.assertEqual(vm_states.STOPPED, instance.vm_state)"},{"line_number":1912,"context_line":""},{"line_number":1913,"context_line":"        do_test()"},{"line_number":1914,"context_line":""},{"line_number":1915,"context_line":"    def _test_cleanup_instances_in_deleting_state(self):"},{"line_number":1916,"context_line":"        instance \u003d fake_instance.fake_instance_obj("},{"line_number":1917,"context_line":"            self.context,"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa98f980_351bfa81","line":1914,"updated":"2014-09-16 11:24:02.000000000","message":"I think you should put all this tests in a new class so you can share code.\n\nI see you\u0027re mocking get_by_filters, is_older_than,\t obj_load_attr, \t\tget_by_instance_uuid, etc... over and over that could be a decorator at the class level, for e.g:\n\n @mock.patch.object(objects.InstanceList, \u0027get_by_filters\u0027)\n @mock.patch.object(timeutils, \u0027is_older_than\u0027)\n ...\n class CleanUpDeletingInstanceUnitTestCase(test.NoDBTestCase):\n\n     def setUp(self):\n         super(...)\n         self.context  \u003d ...\n         self.instance \u003d \n         self.reservations ...\n         self.fake_quotas\n\n    def test_cleanup_instances_in_deleting_state(self, mock_get_by_filters, mock_is_older_than, ...):\n       mock_get_by_filters.return_value \u003d [self.instance]\n       mock_is_older_than.return_value \u003d True\n       ...\n\n       self.compute._cleanup_instances_in_deleting_state(self.context)\n       self.assertEqual(obj_load_attr.call_count, 2)\n       self.assertEqual(reserve.return_value, reservations)\n       self.assertEqual(_delete_instance.call_count, 1)\n\nThis will improve a lot the readability of this tests, and you can share a lot of code between the tests exercising this particular scenario.\n\n(The ComputeManagerUnitTestCase is already _huge_ we should start splitting the tests scenarios out of that class)","commit_id":"186ecd145dbdc1c55e6fed082d403bcd4cef1321"}]}
