)]}'
{"nova/compute/manager.py":[{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"c619a1c9f734ba54a2d76211312a66875ee593be","unresolved":false,"context_lines":[{"line_number":4433,"context_line":"            six.reraise(*exc_info)"},{"line_number":4434,"context_line":""},{"line_number":4435,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4436,"context_line":"                host_list):"},{"line_number":4437,"context_line":"        # Here just for use in tests"},{"line_number":4438,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4439,"context_line":"            instance, None, scheduler_hint, flavor,"}],"source_content_type":"text/x-python","patch_set":1,"id":"bfb3d3c7_78be3466","line":4436,"updated":"2019-05-22 16:51:21.000000000","message":"I\u0027d love to get rid of this (it\u0027s a wrapper and the name is too close to the existing \u0027_resize_instance\u0027 function) but I can\u0027t find anyway to mock out this call from functional tests in a way that doesn\u0027t screw other things up. This might be as good as we can do","commit_id":"32abce58cf8e0fe913a7bddcd0dbf1207b91ed7a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b5f01aa607decf2f756c3466bee71ed88b8f44ef","unresolved":false,"context_lines":[{"line_number":4422,"context_line":"                    retry[\u0027exc\u0027] \u003d traceback.format_exception_only("},{"line_number":4423,"context_line":"                        exc_info[0], exc_info[1])"},{"line_number":4424,"context_line":""},{"line_number":4425,"context_line":"                scheduler_hint \u003d {\u0027filter_properties\u0027: filter_properties}"},{"line_number":4426,"context_line":""},{"line_number":4427,"context_line":"                self._resize(context\u003dcontext, instance\u003dinstance,"},{"line_number":4428,"context_line":"                    scheduler_hint\u003dscheduler_hint, flavor\u003dinstance_type,"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_c025e0c3","line":4425,"updated":"2019-06-06 21:11:08.000000000","message":"This was:\n\nscheduler_hint \u003d dict(filter_properties\u003dfilter_properties)\n\nnot sure why you felt the need to change that.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b5f01aa607decf2f756c3466bee71ed88b8f44ef","unresolved":false,"context_lines":[{"line_number":4424,"context_line":""},{"line_number":4425,"context_line":"                scheduler_hint \u003d {\u0027filter_properties\u0027: filter_properties}"},{"line_number":4426,"context_line":""},{"line_number":4427,"context_line":"                self._resize(context\u003dcontext, instance\u003dinstance,"},{"line_number":4428,"context_line":"                    scheduler_hint\u003dscheduler_hint, flavor\u003dinstance_type,"},{"line_number":4429,"context_line":"                    request_spec\u003drequest_spec, host_list\u003dhost_list)"},{"line_number":4430,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_14001901","line":4427,"updated":"2019-06-06 21:11:08.000000000","message":"I don\u0027t know why you\u0027re using named kwargs on all of these since nothing is optional.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"f571e162b9112d5a8cd2c7de12c0b6747677ff75","unresolved":false,"context_lines":[{"line_number":4424,"context_line":""},{"line_number":4425,"context_line":"                scheduler_hint \u003d {\u0027filter_properties\u0027: filter_properties}"},{"line_number":4426,"context_line":""},{"line_number":4427,"context_line":"                self._resize(context\u003dcontext, instance\u003dinstance,"},{"line_number":4428,"context_line":"                    scheduler_hint\u003dscheduler_hint, flavor\u003dinstance_type,"},{"line_number":4429,"context_line":"                    request_spec\u003drequest_spec, host_list\u003dhost_list)"},{"line_number":4430,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_7dfa9175","line":4427,"in_reply_to":"9fb8cfa7_14001901","updated":"2019-06-07 12:58:08.000000000","message":"Because there is a lot going on here and using named kwargs makes it easier to grok, IMO","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b5f01aa607decf2f756c3466bee71ed88b8f44ef","unresolved":false,"context_lines":[{"line_number":4429,"context_line":"                    request_spec\u003drequest_spec, host_list\u003dhost_list)"},{"line_number":4430,"context_line":""},{"line_number":4431,"context_line":"                rescheduled \u003d True"},{"line_number":4432,"context_line":"            else:"},{"line_number":4433,"context_line":"                # no retry information, do not reschedule."},{"line_number":4434,"context_line":"                LOG.debug(\u0027Retry info not present, will not reschedule\u0027,"},{"line_number":4435,"context_line":"                          instance_uuid\u003dinstance_uuid)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_40649022","line":4432,"updated":"2019-06-06 21:11:08.000000000","message":"OK so this else case before would actually return None which on L4453 below would evaluate to False anyway so we\u0027re fine.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"cf2148ed1a72d21d1e0310235f0bbd55f9e54a12","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bfb3d3c7_713c7ce0","line":4471,"updated":"2019-05-31 11:21:26.000000000","message":"I don\u0027t get this comment. Does the RPC call below is never used in normal operation just our tests depends on it? If yes, then what about all the code that leads to calling _resize() is that also kept for our tests only?\n\nAnd all those tests are testing cellv1 behavior? Then can we also remove them?\n\nIf it just the notification sample tests that causing trouble then I can help re-thinking how to trigger a re-schedule without depending on this exact function to exists.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"f571e162b9112d5a8cd2c7de12c0b6747677ff75","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_9df50586","line":4471,"in_reply_to":"9fb8cfa7_39cbce1e","updated":"2019-06-07 12:58:08.000000000","message":"Sure, done.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"1ec80b7561f94de9c0216c7e26fe2e765bd6f923","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_d9f8844a","line":4471,"in_reply_to":"9fb8cfa7_4227f313","updated":"2019-06-06 13:15:25.000000000","message":"Just to reiterate what I said above, I need a way to mock \u0027ComputeTaskAPI.resize_instance\u0027 but only for one caller. The reason for that is because I want the standard call to run and fail the first time round, and then catch it when it attempts to run the second time (via the reschedule). I could probably rewrite the test to do this but I spent a day trying to do just that and couldn\u0027t figure it out (the tests are _very_ brittle) so this is the best I could do.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"7686f683f25f5c022c51f7ed32a711794cd2154d","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_39cbce1e","line":4471,"in_reply_to":"9fb8cfa7_743155ec","updated":"2019-06-07 09:52:52.000000000","message":"I did the test modification to make it pass https://review.opendev.org/#/c/663873/ . It is gross. :/\n\n@Stephen: If you wish you can squash https://review.opendev.org/#/c/663873/ into this patch.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b5f01aa607decf2f756c3466bee71ed88b8f44ef","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_743155ec","line":4471,"in_reply_to":"9fb8cfa7_d9f8844a","updated":"2019-06-06 21:11:08.000000000","message":"\u003e The reason for that is because I want the standard call to run and fail the first time round, and then catch it when it attempts to run the second time (via the reschedule). I could probably rewrite the test to do this but I spent a day trying to do just that and couldn\u0027t figure it out (the tests are _very_ brittle) so this is the best I could do.\n\nSounds like all you needed was to mock compute_task_api.resize_instance and use a side_effect where you control the calls - the first passes and the 2nd fails:\n\nhttps://docs.python.org/3.6/library/unittest.mock.html#unittest.mock.Mock.side_effect\n\nAnyway, if the test itself is gross it could be a follow up to remove this and re-write the test to use a side_effect.","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"8b32310394a0b2a282bd99cca292e35c8e325242","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_4227f313","line":4471,"in_reply_to":"9fb8cfa7_df62f1d8","updated":"2019-06-04 09:56:04.000000000","message":"It\u0027s also used in cells v2","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"7f5f27b12852b34335a3ebae2941f3c05602853e","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_df62f1d8","line":4471,"in_reply_to":"bfb3d3c7_5d0f0987","updated":"2019-06-03 08:52:08.000000000","message":"Does _reschedule_resize_or_reraise used only in cell v1 code path or also in cell v2 as well?","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"1dac32cf180272e08990dd4b9e7fe9e11227c2f5","unresolved":false,"context_lines":[{"line_number":4468,"context_line":""},{"line_number":4469,"context_line":"    def _resize(self, context, instance, scheduler_hint, flavor, request_spec,"},{"line_number":4470,"context_line":"                host_list):"},{"line_number":4471,"context_line":"        # Here just for use in tests"},{"line_number":4472,"context_line":"        self.compute_task_api.resize_instance(context,"},{"line_number":4473,"context_line":"            instance, None, scheduler_hint, flavor,"},{"line_number":4474,"context_line":"            request_spec\u003drequest_spec, host_list\u003dhost_list)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bfb3d3c7_5d0f0987","line":4471,"in_reply_to":"bfb3d3c7_713c7ce0","updated":"2019-05-31 13:56:20.000000000","message":"Yeah, this wasn\u0027t clear. The comment I left on PS1 hopefully explains it better:\n\n\u003e I\u0027d love to get rid of this (it\u0027s a wrapper and the name is too close to the existing \u0027_resize_instance\u0027 function) but I can\u0027t find anyway to mock out this call from functional tests in a way that doesn\u0027t screw other things up. This might be as good as we can do\n\nSo yeah, I need some way to mock out _this_ call to ComputeTaskAPI.resize_instance but I can\u0027t do it globally since there are other calls which _should_ be processed as usual and it\u0027s only the call from \u0027_reschedule_resize_or_reraise\u0027 that I want to stub out","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"}],"nova/tests/functional/notification_sample_tests/test_instance.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"70bc1c484b9f1a2fc01947f8b6cdaed2c9d70618","unresolved":false,"context_lines":[{"line_number":1065,"context_line":"        about the exception, which caused the prep_resize error."},{"line_number":1066,"context_line":"        \"\"\""},{"line_number":1067,"context_line":"        def _build_resources(*args, **kwargs):"},{"line_number":1068,"context_line":"            # NOTE(gibi): the first resize_instance should be unaffected so"},{"line_number":1069,"context_line":"            # that we can reach _prep_resize at all. But the subsequent"},{"line_number":1070,"context_line":"            # resize_instance calls needs to"},{"line_number":1071,"context_line":"            # be mocked as there is no alternative host to resize to."}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_66fe82af","line":1068,"range":{"start_line":1068,"start_character":30,"end_line":1068,"end_character":35},"updated":"2019-06-07 13:28:47.000000000","message":"By first you mean the call from the API right?","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"70bc1c484b9f1a2fc01947f8b6cdaed2c9d70618","unresolved":false,"context_lines":[{"line_number":1069,"context_line":"            # that we can reach _prep_resize at all. But the subsequent"},{"line_number":1070,"context_line":"            # resize_instance calls needs to"},{"line_number":1071,"context_line":"            # be mocked as there is no alternative host to resize to."},{"line_number":1072,"context_line":"            patcher \u003d mock.patch("},{"line_number":1073,"context_line":"                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027)"},{"line_number":1074,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1075,"context_line":"            patcher.start()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_c6b64efb","line":1072,"updated":"2019-06-07 13:28:47.000000000","message":"Potentially another way to avoid doing this weird mock within the side effect method would be to mock the instance of the method connected to the compute manager itself, e.g.:\n\npatcher \u003d mock.patch.object(\n    self.compute.manager.compute_task_api, \u0027resize_instance\u0027)\netc","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"35220d05cd8e5efcc1aeacf5320ae4398124f347","unresolved":false,"context_lines":[{"line_number":1069,"context_line":"            # that we can reach _prep_resize at all. But the subsequent"},{"line_number":1070,"context_line":"            # resize_instance calls needs to"},{"line_number":1071,"context_line":"            # be mocked as there is no alternative host to resize to."},{"line_number":1072,"context_line":"            patcher \u003d mock.patch("},{"line_number":1073,"context_line":"                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027)"},{"line_number":1074,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1075,"context_line":"            patcher.start()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_ec1a517b","line":1072,"in_reply_to":"9fb8cfa7_2c9389fc","updated":"2019-06-07 14:57:01.000000000","message":"I\u0027m OK with this proposal. It removes at least on level of confusion from these tests.","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3d31cf29a2487a2a8750a538f9aeab406d8ff6c2","unresolved":false,"context_lines":[{"line_number":1069,"context_line":"            # that we can reach _prep_resize at all. But the subsequent"},{"line_number":1070,"context_line":"            # resize_instance calls needs to"},{"line_number":1071,"context_line":"            # be mocked as there is no alternative host to resize to."},{"line_number":1072,"context_line":"            patcher \u003d mock.patch("},{"line_number":1073,"context_line":"                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027)"},{"line_number":1074,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1075,"context_line":"            patcher.start()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_2c9389fc","line":1072,"in_reply_to":"9fb8cfa7_c6b64efb","updated":"2019-06-07 14:51:33.000000000","message":"This is what I did and it works - it moves the patcher out of this side effect method and patches the compute manager\u0027s compute_task_api.resize_instance method instead of the global one that the API would hit.\n\n$ git diff\ndiff --git a/nova/tests/functional/notification_sample_tests/test_instance.py b/nova/tests/functional/notification_sample_tests/test_instance.py\nindex ee37dee77f..33acb73932 100644\n--- a/nova/tests/functional/notification_sample_tests/test_instance.py\n+++ b/nova/tests/functional/notification_sample_tests/test_instance.py\n@@ -1065,14 +1065,6 @@ class TestInstanceNotificationSample(\n         about the exception, which caused the prep_resize error.\n         \"\"\"\n         def _build_resources(*args, **kwargs):\n-            # NOTE(gibi): the first resize_instance should be unaffected so\n-            # that we can reach _prep_resize at all. But the subsequent\n-            # resize_instance calls needs to\n-            # be mocked as there is no alternative host to resize to.\n-            patcher \u003d mock.patch(\n-                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027)\n-            self.addCleanup(patcher.stop)\n-            patcher.start()\n             raise exception.FlavorDiskTooSmall()\n         server \u003d self._boot_a_server(\n             extra_params\u003d{\u0027networks\u0027: [{\u0027port\u0027: self.neutron.port_1[\u0027id\u0027]}]})\n@@ -1095,6 +1087,14 @@ class TestInstanceNotificationSample(\n         }\n         fake_notifier.reset()\n         mock_prep_resize.side_effect \u003d _build_resources\n+        # NOTE(gibi): the first resize_instance call (from the API) should be\n+        # unaffected so that we can reach _prep_resize at all. But the\n+        # subsequent resize_instance call (from _reschedule_resize_or_reraise)\n+        # needs to be mocked as there is no alternative host to resize to.\n+        patcher \u003d mock.patch.object(self.compute.manager.compute_task_api,\n+                                    \u0027resize_instance\u0027)\n+        self.addCleanup(patcher.stop)\n+        patcher.start()\n         self.api.post_server_action(server[\u0027id\u0027], post)\n         self._wait_for_notification(\u0027instance.resize.error\u0027)\n         self._pop_and_verify_dest_select_notification(server[\u0027id\u0027],\n@@ -1138,17 +1138,6 @@ class TestInstanceNotificationSample(\n         send another error.\n         \"\"\"\n         def _build_resources(*args, **kwargs):\n-            # NOTE(gibi): the first resize_instance should be unaffected so\n-            # that we can reach _prep_resize at all. But the subsequent\n-            # resize_instance calls needs to fail.\n-            # It isn\u0027t realistic that ComputeManager._resize would raise\n-            # FlavorDiskTooSmall, but it\u0027s needed for the notification sample\n-            # to work.\n-            patcher \u003d mock.patch(\n-                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027,\n-                side_effect\u003d_build_resources)\n-            self.addCleanup(patcher.stop)\n-            patcher.start()\n             raise exception.FlavorDiskTooSmall()\n \n         server \u003d self._boot_a_server(\n@@ -1172,6 +1161,17 @@ class TestInstanceNotificationSample(\n         }\n         fake_notifier.reset()\n         mock_prep_resize.side_effect \u003d _build_resources\n+        # NOTE(gibi): the first resize_instance call (from the API) should be\n+        # unaffected so that we can reach _prep_resize at all. But the\n+        # subsequent resize_instance call (from _reschedule_resize_or_reraise)\n+        # needs to fail. It isn\u0027t realistic that resize_instance would raise\n+        # FlavorDiskTooSmall, but it\u0027s needed for the notification sample\n+        # to work.\n+        patcher \u003d mock.patch.object(self.compute.manager.compute_task_api,\n+                                    \u0027resize_instance\u0027,\n+                                    side_effect\u003d_build_resources)\n+        self.addCleanup(patcher.stop)\n+        patcher.start()\n         self.api.post_server_action(server[\u0027id\u0027], post)\n         self._wait_for_state_change(self.api, server, expected_status\u003d\u0027ERROR\u0027)\n         self._wait_for_notification(\u0027compute.exception\u0027)","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5bbf64864deaf3cbb97554e76744329f6ae8f6f3","unresolved":false,"context_lines":[{"line_number":1069,"context_line":"            # that we can reach _prep_resize at all. But the subsequent"},{"line_number":1070,"context_line":"            # resize_instance calls needs to"},{"line_number":1071,"context_line":"            # be mocked as there is no alternative host to resize to."},{"line_number":1072,"context_line":"            patcher \u003d mock.patch("},{"line_number":1073,"context_line":"                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027)"},{"line_number":1074,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1075,"context_line":"            patcher.start()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_57e20631","line":1072,"in_reply_to":"9fb8cfa7_ec1a517b","updated":"2019-06-07 15:07:36.000000000","message":"OK I can push that up and +W.","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"70bc1c484b9f1a2fc01947f8b6cdaed2c9d70618","unresolved":false,"context_lines":[{"line_number":1141,"context_line":"            # NOTE(gibi): the first resize_instance should be unaffected so"},{"line_number":1142,"context_line":"            # that we can reach _prep_resize at all. But the subsequent"},{"line_number":1143,"context_line":"            # resize_instance calls needs to fail."},{"line_number":1144,"context_line":"            # It isn\u0027t realistic that ComputeManager._resize would raise"},{"line_number":1145,"context_line":"            # FlavorDiskTooSmall, but it\u0027s needed for the notification sample"},{"line_number":1146,"context_line":"            # to work."},{"line_number":1147,"context_line":"            patcher \u003d mock.patch("}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_86d05621","line":1144,"range":{"start_line":1144,"start_character":53,"end_line":1144,"end_character":60},"updated":"2019-06-07 13:28:47.000000000","message":"This method no longer exists.","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"70bc1c484b9f1a2fc01947f8b6cdaed2c9d70618","unresolved":false,"context_lines":[{"line_number":1145,"context_line":"            # FlavorDiskTooSmall, but it\u0027s needed for the notification sample"},{"line_number":1146,"context_line":"            # to work."},{"line_number":1147,"context_line":"            patcher \u003d mock.patch("},{"line_number":1148,"context_line":"                \u0027nova.conductor.api.ComputeTaskAPI.resize_instance\u0027,"},{"line_number":1149,"context_line":"                side_effect\u003d_build_resources)"},{"line_number":1150,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1151,"context_line":"            patcher.start()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fb8cfa7_06a226af","line":1148,"updated":"2019-06-07 13:28:47.000000000","message":"Again this could be cleaner I think if we just mocked the compute_task_api on self.compute.manager directly and then I don\u0027t think it will be mocking the global ComputeTaskAPI.resize_instance method and the API would be unaffected. You could do that outside of this side effect method.","commit_id":"c6aa5828183837a5e3cb9229758097e3f64acf9a"}],"nova/tests/unit/compute/test_compute.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b5f01aa607decf2f756c3466bee71ed88b8f44ef","unresolved":false,"context_lines":[{"line_number":12805,"context_line":"        self.request_spec \u003d objects.RequestSpec()"},{"line_number":12806,"context_line":""},{"line_number":12807,"context_line":"        def fake_update(*args, **kwargs):"},{"line_number":12808,"context_line":"            self.updated_task_state \u003d kwargs.get(\u0027task_state\u0027)"},{"line_number":12809,"context_line":""},{"line_number":12810,"context_line":"        self.stub_out(\u0027nova.compute.manager.ComputeManager._instance_update\u0027,"},{"line_number":12811,"context_line":"                      fake_update)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_546451e4","line":12808,"updated":"2019-06-06 21:11:08.000000000","message":"This isn\u0027t used in the tests. It looks like the old tests would assert that the task_state was reset, but you\u0027re not doing that as far as I can tell. So I could remove the call to _instance_update from the code and the tests won\u0027t fail, right (I confirmed, yes)? So you should probably check self.updated_task_state in the tests or just mock _instance_update and assert it\u0027s called (which seems cleaner to me).","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"f571e162b9112d5a8cd2c7de12c0b6747677ff75","unresolved":false,"context_lines":[{"line_number":12805,"context_line":"        self.request_spec \u003d objects.RequestSpec()"},{"line_number":12806,"context_line":""},{"line_number":12807,"context_line":"        def fake_update(*args, **kwargs):"},{"line_number":12808,"context_line":"            self.updated_task_state \u003d kwargs.get(\u0027task_state\u0027)"},{"line_number":12809,"context_line":""},{"line_number":12810,"context_line":"        self.stub_out(\u0027nova.compute.manager.ComputeManager._instance_update\u0027,"},{"line_number":12811,"context_line":"                      fake_update)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_3df41986","line":12808,"in_reply_to":"9fb8cfa7_546451e4","updated":"2019-06-07 12:58:08.000000000","message":"Done (the latter, cleaner option)","commit_id":"4a96baac18f1e0e0f722ec3a300d0248f50f9663"}]}
