)]}'
{"nova_powervm/tests/virt/powervm/test_event.py":[{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"7abcf6aa5ef7214397b37c93ddf98c5b7c4495da","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @mock.patch(\u0027nova_powervm.virt.powervm.event._get_instance\u0027)"},{"line_number":63,"context_line":"    def test_handle_inst_event(self, mock_get_instance):"},{"line_number":64,"context_line":"        # If no event we care about, or NVRAM but no nvram_mgr, nothing happens"},{"line_number":65,"context_line":"        self.mock_driver.nvram_mgr \u003d None"},{"line_number":66,"context_line":"        for dets in ([], [\u0027foo\u0027, \u0027bar\u0027, \u0027baz\u0027], [\u0027NVRAM\u0027]):"},{"line_number":67,"context_line":"            self.assertEqual(\u0027inst\u0027, self.handler._handle_inst_event("}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_57c4b13f","line":64,"updated":"2017-06-05 19:55:51.000000000","message":"I\u0027d like to see \"no nvram_mgr\" tested separately. The first 2 iterations of the following for loop should be tested even with nvram_mgr.","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"12e5cc01e53f7dc0a0acf1fe756982bdb96ac42c","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @mock.patch(\u0027nova_powervm.virt.powervm.event._get_instance\u0027)"},{"line_number":63,"context_line":"    def test_handle_inst_event(self, mock_get_instance):"},{"line_number":64,"context_line":"        # If no event we care about, or NVRAM but no nvram_mgr, nothing happens"},{"line_number":65,"context_line":"        self.mock_driver.nvram_mgr \u003d None"},{"line_number":66,"context_line":"        for dets in ([], [\u0027foo\u0027, \u0027bar\u0027, \u0027baz\u0027], [\u0027NVRAM\u0027]):"},{"line_number":67,"context_line":"            self.assertEqual(\u0027inst\u0027, self.handler._handle_inst_event("}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_78eb0612","line":64,"in_reply_to":"df140735_57c4b13f","updated":"2017-06-06 15:16:43.000000000","message":"Per IRC discussion [1], leaving this alone.\n\n[1] http://eavesdrop.openstack.org/irclogs/%23openstack-powervm/%23openstack-powervm.2017-06-06.log.html#t2017-06-06T15:02:47","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"7abcf6aa5ef7214397b37c93ddf98c5b7c4495da","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        mock_handle.assert_not_called()"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        moduri \u003d pvm_evt.EventType.MODIFY_URI"},{"line_number":123,"context_line":"        # If get_req_path_uuid doesn\u0027t find a UUID, or not a LogicalPartitionn"},{"line_number":124,"context_line":"        # URI, or details is empty, or has no actions we care about, no action"},{"line_number":125,"context_line":"        # is taken."},{"line_number":126,"context_line":"        mock_get_rpu.side_effect \u003d [None, \u0027uuid1\u0027, \u0027uuid2\u0027, \u0027uuid3\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_d76b21ee","line":123,"range":{"start_line":123,"start_character":61,"end_line":123,"end_character":78},"updated":"2017-06-05 19:55:51.000000000","message":"spelling: LogicalPartition*","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"12e5cc01e53f7dc0a0acf1fe756982bdb96ac42c","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        mock_handle.assert_not_called()"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        moduri \u003d pvm_evt.EventType.MODIFY_URI"},{"line_number":123,"context_line":"        # If get_req_path_uuid doesn\u0027t find a UUID, or not a LogicalPartitionn"},{"line_number":124,"context_line":"        # URI, or details is empty, or has no actions we care about, no action"},{"line_number":125,"context_line":"        # is taken."},{"line_number":126,"context_line":"        mock_get_rpu.side_effect \u003d [None, \u0027uuid1\u0027, \u0027uuid2\u0027, \u0027uuid3\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_98b13a47","line":123,"range":{"start_line":123,"start_character":61,"end_line":123,"end_character":78},"in_reply_to":"df140735_d76b21ee","updated":"2017-06-06 15:16:43.000000000","message":"Done","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"7abcf6aa5ef7214397b37c93ddf98c5b7c4495da","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        mock_spawn.reset_mock()"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        # Second call cancels the first thread and replaces it in delay queue"},{"line_number":273,"context_line":"        self.handler.process(\u0027inst2\u0027, \u0027uuid\u0027)"},{"line_number":274,"context_line":"        mock_spawn.assert_called_once_with(15, self.handler._emit_event,"},{"line_number":275,"context_line":"                                           \u0027uuid\u0027, \u0027inst2\u0027)"},{"line_number":276,"context_line":"        self.assertEqual({\u0027uuid\u0027: thread2},"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_725d8345","line":273,"range":{"start_line":273,"start_character":30,"end_line":273,"end_character":35},"updated":"2017-06-05 19:55:51.000000000","message":"it looks odd to not use \u0027inst\u0027 here, since there should be a 1-to-1 mapping of uuid to inst, and you used \u0027inst\u0027 above.\n\nIf you want to use different values for some reason, I\u0027d use None on the first thread and \u0027inst\u0027 on the 2nd, as in the case where the later event was able to use caching that happened between them.","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"12e5cc01e53f7dc0a0acf1fe756982bdb96ac42c","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        mock_spawn.reset_mock()"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        # Second call cancels the first thread and replaces it in delay queue"},{"line_number":273,"context_line":"        self.handler.process(\u0027inst2\u0027, \u0027uuid\u0027)"},{"line_number":274,"context_line":"        mock_spawn.assert_called_once_with(15, self.handler._emit_event,"},{"line_number":275,"context_line":"                                           \u0027uuid\u0027, \u0027inst2\u0027)"},{"line_number":276,"context_line":"        self.assertEqual({\u0027uuid\u0027: thread2},"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_18a64a10","line":273,"range":{"start_line":273,"start_character":30,"end_line":273,"end_character":35},"in_reply_to":"df140735_725d8345","updated":"2017-06-06 15:16:43.000000000","message":"Good suggestion, done.","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"}],"nova_powervm/virt/powervm/event.py":[{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"4959cfaf3deca11dcf22d93a53c00cd7ac631735","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                details \u003d (pvm_event.detail.split(\u0027,\u0027) if pvm_event.detail"},{"line_number":110,"context_line":"                           else [])"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                if pvm_event.etype not in pvm_evt.EventType.NEW_CLIENT:"},{"line_number":113,"context_line":"                    LOG.debug(\u0027PowerVM Event-Action: %s URI: %s Details %s\u0027,"},{"line_number":114,"context_line":"                              pvm_event.etype, pvm_event.data, details)"},{"line_number":115,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_event("}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0b0f6d37","side":"PARENT","line":112,"range":{"start_line":112,"start_character":19,"end_line":112,"end_character":70},"updated":"2017-06-02 15:16:31.000000000","message":"So this obviously never worked.","commit_id":"484eaee78cf3f6aceb2bd208221d26e6d5e06fa8"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"078c216dfe68d98c59561693418fc75e4abfc0d8","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                details \u003d (pvm_event.detail.split(\u0027,\u0027) if pvm_event.detail"},{"line_number":110,"context_line":"                           else [])"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                if pvm_event.etype not in pvm_evt.EventType.NEW_CLIENT:"},{"line_number":113,"context_line":"                    LOG.debug(\u0027PowerVM Event-Action: %s URI: %s Details %s\u0027,"},{"line_number":114,"context_line":"                              pvm_event.etype, pvm_event.data, details)"},{"line_number":115,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_event("}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_d9a82f21","side":"PARENT","line":112,"range":{"start_line":112,"start_character":19,"end_line":112,"end_character":70},"in_reply_to":"df140735_0b0f6d37","updated":"2017-06-02 15:58:47.000000000","message":"Well, it never did anything.  \u0027foo\u0027 in \u0027foo\u0027 would be True, but the only effect would have been to avoid emitting the log message; the _handle_event call was outside of this condition anyway.  (We would have wound up no-opping further down the line, because NEW_CLIENT events never have an LPAR URI.)","commit_id":"484eaee78cf3f6aceb2bd208221d26e6d5e06fa8"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":35,"context_line":"_CONTEXT \u003d None"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"def _get_instance(inst, pvm_uuid):"},{"line_number":39,"context_line":"    global _CONTEXT"},{"line_number":40,"context_line":"    if inst is not None:"},{"line_number":41,"context_line":"        return inst"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_599c1f0d","line":38,"range":{"start_line":38,"start_character":18,"end_line":38,"end_character":22},"updated":"2017-06-02 16:00:01.000000000","message":"can move the cache lookup into this method and no longer need to pass inst here, since this is only ever called immediately after having done a cache lookup (don\u0027t separately know the inst)","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":35,"context_line":"_CONTEXT \u003d None"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"def _get_instance(inst, pvm_uuid):"},{"line_number":39,"context_line":"    global _CONTEXT"},{"line_number":40,"context_line":"    if inst is not None:"},{"line_number":41,"context_line":"        return inst"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_144c2e40","line":38,"range":{"start_line":38,"start_character":18,"end_line":38,"end_character":22},"in_reply_to":"df140735_599c1f0d","updated":"2017-06-02 16:14:11.000000000","message":"Could, but would have to pass the cache into this method, which I considered (slightly) more evil.  Note that the cache is very short-lived: only for one invocation of process().","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":42,"context_line":"    if _CONTEXT is None:"},{"line_number":43,"context_line":"        _CONTEXT \u003d ctx.get_admin_context()"},{"line_number":44,"context_line":"    LOG.debug(\u0027PowerVM Nova Event Handler: Getting inst for id %s\u0027, pvm_uuid)"},{"line_number":45,"context_line":"    return vm.get_instance(_CONTEXT, pvm_uuid)"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"class PowerVMNovaEventHandler(pvm_apt.WrapperEventHandler):"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_190fc737","line":45,"updated":"2017-06-02 16:00:01.000000000","message":"if we got here, we should populate the cache with what we read. Of course if we subsequently change something, we\u0027ll have to update the cache again, but we don\u0027t know yet whether we\u0027ll have to do that.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":42,"context_line":"    if _CONTEXT is None:"},{"line_number":43,"context_line":"        _CONTEXT \u003d ctx.get_admin_context()"},{"line_number":44,"context_line":"    LOG.debug(\u0027PowerVM Nova Event Handler: Getting inst for id %s\u0027, pvm_uuid)"},{"line_number":45,"context_line":"    return vm.get_instance(_CONTEXT, pvm_uuid)"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"class PowerVMNovaEventHandler(pvm_apt.WrapperEventHandler):"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_b44ea235","line":45,"in_reply_to":"df140735_190fc737","updated":"2017-06-02 16:14:11.000000000","message":"See above.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        # If the NVRAM has changed for this instance and a store is configured."},{"line_number":69,"context_line":"        if \u0027NVRAM\u0027 in details and self._driver.nvram_mgr is not None:"},{"line_number":70,"context_line":"            # Schedule the NVRAM for the instance to be stored."},{"line_number":71,"context_line":"            inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":72,"context_line":"            if inst is None:"},{"line_number":73,"context_line":"                return None"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_19610706","line":71,"updated":"2017-06-02 16:00:01.000000000","message":"inst won\u0027t be set for the following PartitionState handling block if this NVRAM block isn\u0027t entered and there wasn\u0027t one in the cache","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        # If the NVRAM has changed for this instance and a store is configured."},{"line_number":69,"context_line":"        if \u0027NVRAM\u0027 in details and self._driver.nvram_mgr is not None:"},{"line_number":70,"context_line":"            # Schedule the NVRAM for the instance to be stored."},{"line_number":71,"context_line":"            inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":72,"context_line":"            if inst is None:"},{"line_number":73,"context_line":"                return None"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_d46a367f","line":71,"in_reply_to":"df140735_19610706","updated":"2017-06-02 16:14:11.000000000","message":"Correct.  All the downstack stuff is set up to tolerate inst \u003d\u003d None - which is kinda the point of this change set.  (The code path you highlight is actually the main one exercised in my testing.)","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        # If the NVRAM has changed for this instance and a store is configured."},{"line_number":69,"context_line":"        if \u0027NVRAM\u0027 in details and self._driver.nvram_mgr is not None:"},{"line_number":70,"context_line":"            # Schedule the NVRAM for the instance to be stored."},{"line_number":71,"context_line":"            inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":72,"context_line":"            if inst is None:"},{"line_number":73,"context_line":"                return None"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_5443c66c","line":71,"in_reply_to":"df140735_d46a367f","updated":"2017-06-02 16:47:24.000000000","message":"ah, that makes sense, now that I\u0027m looking at the other handler and _emit_event.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":77,"context_line":""},{"line_number":78,"context_line":"        # If the state of the vm changed see if it should be handled"},{"line_number":79,"context_line":"        if \u0027PartitionState\u0027 in details:"},{"line_number":80,"context_line":"            self._lifecycle_handler.process(inst, pvm_uuid)"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"        return inst"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_39d3abd7","line":80,"range":{"start_line":80,"start_character":50,"end_line":80,"end_character":58},"updated":"2017-06-02 16:00:01.000000000","message":"surely the inst knows the pvm_uuid so we don\u0027t need to pass it, right?","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":77,"context_line":""},{"line_number":78,"context_line":"        # If the state of the vm changed see if it should be handled"},{"line_number":79,"context_line":"        if \u0027PartitionState\u0027 in details:"},{"line_number":80,"context_line":"            self._lifecycle_handler.process(inst, pvm_uuid)"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"        return inst"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_1429cee4","line":80,"range":{"start_line":80,"start_character":50,"end_line":80,"end_character":58},"in_reply_to":"df140735_342a922b","updated":"2017-06-02 16:47:24.000000000","message":"yeah, my comment was assuming we needed to move _get_instance out of the previous if block so that it would be set here. If we don\u0027t do that, then you\u0027re absolutely right.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":77,"context_line":""},{"line_number":78,"context_line":"        # If the state of the vm changed see if it should be handled"},{"line_number":79,"context_line":"        if \u0027PartitionState\u0027 in details:"},{"line_number":80,"context_line":"            self._lifecycle_handler.process(inst, pvm_uuid)"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"        return inst"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_342a922b","line":80,"range":{"start_line":80,"start_character":50,"end_line":80,"end_character":58},"in_reply_to":"df140735_39d3abd7","updated":"2017-06-02 16:14:11.000000000","message":"inst can be (and very often is) None here.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        inst_cache \u003d {}"},{"line_number":90,"context_line":"        for pvm_event in events:"},{"line_number":91,"context_line":"            try:"},{"line_number":92,"context_line":"                if pvm_event.etype in (pvm_evt.EventType.NEW_CLIENT,"},{"line_number":93,"context_line":"                                       pvm_evt.EventType.CACHE_CLEARED):"},{"line_number":94,"context_line":"                    # Should we pull and check all the LPARs??"},{"line_number":95,"context_line":"                    continue"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0ed1bb23","line":92,"updated":"2017-06-02 16:00:01.000000000","message":"pull this out of the try block","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        inst_cache \u003d {}"},{"line_number":90,"context_line":"        for pvm_event in events:"},{"line_number":91,"context_line":"            try:"},{"line_number":92,"context_line":"                if pvm_event.etype in (pvm_evt.EventType.NEW_CLIENT,"},{"line_number":93,"context_line":"                                       pvm_evt.EventType.CACHE_CLEARED):"},{"line_number":94,"context_line":"                    # Should we pull and check all the LPARs??"},{"line_number":95,"context_line":"                    continue"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_d4c6b668","line":92,"in_reply_to":"df140735_0ed1bb23","updated":"2017-06-02 16:14:11.000000000","message":"Can do... unless we add code to handle these event types.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"a54229bf8a7467b7948adbb28794fc8431f3d51f","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        inst_cache \u003d {}"},{"line_number":90,"context_line":"        for pvm_event in events:"},{"line_number":91,"context_line":"            try:"},{"line_number":92,"context_line":"                if pvm_event.etype in (pvm_evt.EventType.NEW_CLIENT,"},{"line_number":93,"context_line":"                                       pvm_evt.EventType.CACHE_CLEARED):"},{"line_number":94,"context_line":"                    # Should we pull and check all the LPARs??"},{"line_number":95,"context_line":"                    continue"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0e6f76fc","line":92,"in_reply_to":"df140735_d4c6b668","updated":"2017-06-02 18:31:52.000000000","message":"On second thought, no; pvm_event.etype should never give AttributeError, but...","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":91,"context_line":"            try:"},{"line_number":92,"context_line":"                if pvm_event.etype in (pvm_evt.EventType.NEW_CLIENT,"},{"line_number":93,"context_line":"                                       pvm_evt.EventType.CACHE_CLEARED):"},{"line_number":94,"context_line":"                    # Should we pull and check all the LPARs??"},{"line_number":95,"context_line":"                    continue"},{"line_number":96,"context_line":"                # See if this uri (from data) ends with a PowerVM UUID."},{"line_number":97,"context_line":"                pvm_uuid \u003d pvm_util.get_req_path_uuid("}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_8ea26bad","line":94,"updated":"2017-06-02 16:00:01.000000000","message":"sounds like we need a TODO here","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":91,"context_line":"            try:"},{"line_number":92,"context_line":"                if pvm_event.etype in (pvm_evt.EventType.NEW_CLIENT,"},{"line_number":93,"context_line":"                                       pvm_evt.EventType.CACHE_CLEARED):"},{"line_number":94,"context_line":"                    # Should we pull and check all the LPARs??"},{"line_number":95,"context_line":"                    continue"},{"line_number":96,"context_line":"                # See if this uri (from data) ends with a PowerVM UUID."},{"line_number":97,"context_line":"                pvm_uuid \u003d pvm_util.get_req_path_uuid("}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_f492da56","line":94,"in_reply_to":"df140735_8ea26bad","updated":"2017-06-02 16:14:11.000000000","message":"Yeah, kinda want to have a discussion as to whether we should do this or not, and either remove this comment, change it to a TODO, or implement it.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"4959cfaf3deca11dcf22d93a53c00cd7ac631735","unresolved":false,"context_lines":[{"line_number":99,"context_line":"                if pvm_uuid is None:"},{"line_number":100,"context_line":"                    continue"},{"line_number":101,"context_line":"                # Is it an instance event?"},{"line_number":102,"context_line":"                if not pvm_event.data.endswith(\u0027LogicalPartition/\u0027 + pvm_uuid):"},{"line_number":103,"context_line":"                    continue"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"                # Pull all the pieces of the event."}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_eeac47ee","line":102,"updated":"2017-06-02 15:16:31.000000000","message":"Do we want a \u0027/LogicalPartition/\u0027 ?\n\nYou raised that concern in IRC, though I don\u0027t know that it matters much.\n\nTBH - just ending with the pvm_uuid seems almost enough.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"078c216dfe68d98c59561693418fc75e4abfc0d8","unresolved":false,"context_lines":[{"line_number":99,"context_line":"                if pvm_uuid is None:"},{"line_number":100,"context_line":"                    continue"},{"line_number":101,"context_line":"                # Is it an instance event?"},{"line_number":102,"context_line":"                if not pvm_event.data.endswith(\u0027LogicalPartition/\u0027 + pvm_uuid):"},{"line_number":103,"context_line":"                    continue"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"                # Pull all the pieces of the event."}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_6e31575a","line":102,"in_reply_to":"df140735_eeac47ee","updated":"2017-06-02 15:58:47.000000000","message":"Meh.\n\nThe thing I was talking about in IRC was if, say, it was VirtualIOServer/{uuid}.  There\u0027s no other REST object name with a suffix of LogicalPartition.  And you\u0027re right - there should be no other URI ending with an LPAR\u0027s UUID that isn\u0027t for the LPAR.  I kept this because it was in the original, and it\u0027s pretty cheap.  But I wouldn\u0027t object to removing it.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"4959cfaf3deca11dcf22d93a53c00cd7ac631735","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                details \u003d (pvm_event.detail.split(\u0027,\u0027) if pvm_event.detail"},{"line_number":107,"context_line":"                           else [])"},{"line_number":108,"context_line":"                # Is it one we care about?"},{"line_number":109,"context_line":"                if not self.inst_actions_handled \u0026 set(details):"},{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_ce8e2378","line":109,"range":{"start_line":109,"start_character":23,"end_line":109,"end_character":48},"updated":"2017-06-02 15:16:31.000000000","message":"Do we start to care about synchronization here?\n\nCan\u0027t multiple things call process at once (theoretically)?","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"078c216dfe68d98c59561693418fc75e4abfc0d8","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                details \u003d (pvm_event.detail.split(\u0027,\u0027) if pvm_event.detail"},{"line_number":107,"context_line":"                           else [])"},{"line_number":108,"context_line":"                # Is it one we care about?"},{"line_number":109,"context_line":"                if not self.inst_actions_handled \u0026 set(details):"},{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0edc1be2","line":109,"range":{"start_line":109,"start_character":23,"end_line":109,"end_character":48},"in_reply_to":"df140735_ce8e2378","updated":"2017-06-02 15:58:47.000000000","message":"inst_actions_handled never changes (should mebbe upcase it to make it appear more const-ish) and the event details are pulled out of just this one event.\n\nThis event handler is registered exactly once per compute process, so this method is never called more than once at a time.  If it were, it would be getting called with the same set of events, and that would open a whole nother can of worms anyway.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"fe1986423856c77f1bb794160e4681e9e983a0f4","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                if not self.inst_actions_handled \u0026 set(details):"},{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_791a43cc","line":112,"updated":"2017-06-02 16:00:01.000000000","message":"we don\u0027t really need the inst here, so we can clean this up by moving the inst lookup and cache update into _handle_inst_event","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"959bf6d39030b6ab9a4a2f42f6ecb2f6930d4a94","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                if not self.inst_actions_handled \u0026 set(details):"},{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_74c24a5b","line":112,"in_reply_to":"df140735_791a43cc","updated":"2017-06-02 16:14:11.000000000","message":"Again, prefer to keep the cache management within the context of the cache var, which is local to this method.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"4959cfaf3deca11dcf22d93a53c00cd7ac631735","unresolved":false,"context_lines":[{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0ee89bdf","line":113,"range":{"start_line":113,"start_character":21,"end_line":113,"end_character":50},"updated":"2017-06-02 15:16:31.000000000","message":"Cache seems...like a bad idea.\n\nI know the one thing Jeremy really wants avoided is loading these instances unless we need to.  You\u0027ve gone pretty far the other way and load them only if we need to and only do it once.\n\nLooking to see how this gets used...","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"078c216dfe68d98c59561693418fc75e4abfc0d8","unresolved":false,"context_lines":[{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_d9e14f9d","line":113,"range":{"start_line":113,"start_character":21,"end_line":113,"end_character":50},"in_reply_to":"df140735_0ee89bdf","updated":"2017-06-02 15:58:47.000000000","message":"See comments below.  Also keep in mind that this cache is VERY short-lived - it only exists for the duration of a single chunk of PowerVM events - so it only has an effect if one chunk contains multiple events for the same LPAR.  If the next chunk of events comes in and references the same inst, it\u0027ll get reloaded, and the old delayed event (with the old copy) will get removed.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4f0d48e81c74e97cb7e6cc1e2ac4d6e7b392da79","unresolved":false,"context_lines":[{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0ed3f6d6","line":113,"range":{"start_line":113,"start_character":21,"end_line":113,"end_character":50},"in_reply_to":"df140735_ae6aca7d","updated":"2017-06-02 18:14:33.000000000","message":"Agree it\u0027s almost never helping us.  We do actually get NVRAM+PartitionState in the same event (not just the same process() loop) fairly frequently, which is why I put the NVRAM condition first - so we\u0027ll fetch the instance at that point and have it available for the PartitionState handling.  But you\u0027re correct that the cache only helps if the same process() chunk contains a second handled event.  I agree that\u0027s probably rare, but seems like it would be more likely at scale when we need it the most.\n\nIf you haven\u0027t started testing this yet - I can factor the caching into a method where we can log the misses, and we can get some real data on it.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":18378,"name":"Jeremy Arnold","email":"arnoldje@us.ibm.com","username":"arnoldje"},"change_message_id":"2fffeb8d540a0b85321963948e5c0e6160fe54d2","unresolved":false,"context_lines":[{"line_number":110,"context_line":"                    continue"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_ae6aca7d","line":113,"range":{"start_line":113,"start_character":21,"end_line":113,"end_character":50},"in_reply_to":"df140735_d9e14f9d","updated":"2017-06-02 17:59:52.000000000","message":"I don\u0027t see a problem with the implementation of the cache (very similar to the old code).  But I\u0027m not sure it\u0027s actually helping us.  It used to be a big deal when we had event polling.  But now it\u0027s only going to be a benefit if we receive an NVRAM and PartitionState event for the same LPAR in the same cycle (this happens, but not very regularly), and if the NVRAM event is before the PartitionState event, and if we don\u0027t get a subsequent PartitionState event for the same LPAR within the next 15 seconds.  This combination is rare enough that I\u0027d be okay with eliminating the inst_cache if that makes the code more readable.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"},{"line_number":117,"context_line":"                              pvm_event.data)"},{"line_number":118,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_54af467c","line":115,"range":{"start_line":115,"start_character":19,"end_line":115,"end_character":28},"updated":"2017-06-02 16:47:24.000000000","message":"not a new problem, but if you\u0027re in here this deep... Are there more specific exceptions that we should expecting here? Even if we still need to expect Exception for unexpected errors, so we don\u0027t have to print the stack trace for things we do expect.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4f0d48e81c74e97cb7e6cc1e2ac4d6e7b392da79","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                inst_cache[pvm_event.data] \u003d self._handle_inst_event("},{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"},{"line_number":117,"context_line":"                              pvm_event.data)"},{"line_number":118,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_6e2cb201","line":115,"range":{"start_line":115,"start_character":19,"end_line":115,"end_character":28},"in_reply_to":"df140735_54af467c","updated":"2017-06-02 18:14:33.000000000","message":"Right - at one point I started trying to track down all the possibilities, but that seemed more effort than it was worth.\n\nI don\u0027t know the exact scope of the blowup if we raise up at this point, but at best, we would end up skipping the rest of the events in this chunk, which we don\u0027t want.  That\u0027s why I ultimately ended up leaving this as broad as it is.  The LOG.exception will print the stack trace.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"},{"line_number":117,"context_line":"                              pvm_event.data)"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_7f534318","line":116,"range":{"start_line":116,"start_character":31,"end_line":116,"end_character":74},"updated":"2017-06-02 16:47:24.000000000","message":"also not a new problem, but there\u0027s no way this message is correct in all cases that an Exception was raised.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4f0d48e81c74e97cb7e6cc1e2ac4d6e7b392da79","unresolved":false,"context_lines":[{"line_number":113,"context_line":"                    inst_cache.get(pvm_event.data), pvm_uuid, details)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            except Exception:"},{"line_number":116,"context_line":"                LOG.exception(\u0027Unable to parse event URI: %s from PowerVM.\u0027,"},{"line_number":117,"context_line":"                              pvm_event.data)"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0eb416d0","line":116,"range":{"start_line":116,"start_character":31,"end_line":116,"end_character":74},"in_reply_to":"df140735_7f534318","updated":"2017-06-02 18:14:33.000000000","message":"True.  I had a patch set at some point where I changed \u0027parse\u0027 to \u0027process\u0027.  I\u0027ll reinstate that.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"4959cfaf3deca11dcf22d93a53c00cd7ac631735","unresolved":false,"context_lines":[{"line_number":134,"context_line":"    shortly after it."},{"line_number":135,"context_line":"    \"\"\""},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    _NO_EVENT_TASK_STATES \u003d ("},{"line_number":138,"context_line":"        task_states.SPAWNING,"},{"line_number":139,"context_line":"        task_states.RESIZE_MIGRATING,"},{"line_number":140,"context_line":"        task_states.RESIZE_REVERTING,"},{"line_number":141,"context_line":"        task_states.REBOOTING,"},{"line_number":142,"context_line":"        task_states.REBOOTING_HARD,"},{"line_number":143,"context_line":"        task_states.REBOOT_STARTED_HARD,"},{"line_number":144,"context_line":"        task_states.PAUSING,"},{"line_number":145,"context_line":"        task_states.UNPAUSING,"},{"line_number":146,"context_line":"        task_states.SUSPENDING,"},{"line_number":147,"context_line":"        task_states.RESUMING,"},{"line_number":148,"context_line":"        task_states.POWERING_OFF,"},{"line_number":149,"context_line":"        task_states.POWERING_ON,"},{"line_number":150,"context_line":"        task_states.RESCUING,"},{"line_number":151,"context_line":"        task_states.UNRESCUING,"},{"line_number":152,"context_line":"        task_states.REBUILDING,"},{"line_number":153,"context_line":"        task_states.REBUILD_SPAWNING,"},{"line_number":154,"context_line":"        task_states.MIGRATING,"},{"line_number":155,"context_line":"        task_states.DELETING,"},{"line_number":156,"context_line":"        task_states.SOFT_DELETING,"},{"line_number":157,"context_line":"        task_states.RESTORING,"},{"line_number":158,"context_line":"        task_states.SHELVING,"},{"line_number":159,"context_line":"        task_states.SHELVING_OFFLOADING,"},{"line_number":160,"context_line":"        task_states.UNSHELVING,"},{"line_number":161,"context_line":"    )"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"    def __init__(self, driver):"},{"line_number":164,"context_line":"        self._driver \u003d driver"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_8e614bac","line":161,"range":{"start_line":137,"start_character":0,"end_line":161,"end_character":5},"updated":"2017-06-02 15:16:31.000000000","message":"So I understand why...\n\nBut theoretically the compute manager is doing this for you already.\n\nI thought around here: https://github.com/openstack/nova/blob/master/nova/compute/manager.py#L1068","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"078c216dfe68d98c59561693418fc75e4abfc0d8","unresolved":false,"context_lines":[{"line_number":134,"context_line":"    shortly after it."},{"line_number":135,"context_line":"    \"\"\""},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    _NO_EVENT_TASK_STATES \u003d ("},{"line_number":138,"context_line":"        task_states.SPAWNING,"},{"line_number":139,"context_line":"        task_states.RESIZE_MIGRATING,"},{"line_number":140,"context_line":"        task_states.RESIZE_REVERTING,"},{"line_number":141,"context_line":"        task_states.REBOOTING,"},{"line_number":142,"context_line":"        task_states.REBOOTING_HARD,"},{"line_number":143,"context_line":"        task_states.REBOOT_STARTED_HARD,"},{"line_number":144,"context_line":"        task_states.PAUSING,"},{"line_number":145,"context_line":"        task_states.UNPAUSING,"},{"line_number":146,"context_line":"        task_states.SUSPENDING,"},{"line_number":147,"context_line":"        task_states.RESUMING,"},{"line_number":148,"context_line":"        task_states.POWERING_OFF,"},{"line_number":149,"context_line":"        task_states.POWERING_ON,"},{"line_number":150,"context_line":"        task_states.RESCUING,"},{"line_number":151,"context_line":"        task_states.UNRESCUING,"},{"line_number":152,"context_line":"        task_states.REBUILDING,"},{"line_number":153,"context_line":"        task_states.REBUILD_SPAWNING,"},{"line_number":154,"context_line":"        task_states.MIGRATING,"},{"line_number":155,"context_line":"        task_states.DELETING,"},{"line_number":156,"context_line":"        task_states.SOFT_DELETING,"},{"line_number":157,"context_line":"        task_states.RESTORING,"},{"line_number":158,"context_line":"        task_states.SHELVING,"},{"line_number":159,"context_line":"        task_states.SHELVING_OFFLOADING,"},{"line_number":160,"context_line":"        task_states.UNSHELVING,"},{"line_number":161,"context_line":"    )"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"    def __init__(self, driver):"},{"line_number":164,"context_line":"        self._driver \u003d driver"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_ae8c0fd7","line":161,"range":{"start_line":137,"start_character":0,"end_line":161,"end_character":5},"in_reply_to":"df140735_8e614bac","updated":"2017-06-02 15:58:47.000000000","message":"_sync_power_state runs periodically, totally independent of any of this code.  Besides, that uses power_state, not task_state.  And my live testing bears this out - when I include this part of the logic, we don\u0027t send lifecycle events during the nova task; without it, we do.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                      \"delayed.\", pvm_uuid)"},{"line_number":176,"context_line":"            return"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"        LOG.debug(\u0027New state %s for partition %s\u0027, pvm_state, pvm_uuid, instance\u003dinst)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"        inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":181,"context_line":"        if inst is None:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_94a27ead","line":178,"range":{"start_line":178,"start_character":29,"end_line":178,"end_character":31},"updated":"2017-06-02 16:47:24.000000000","message":"name these substitution vars","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"b393a1afff709924e729b5580f6c710e90d6c7a4","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                      \"delayed.\", pvm_uuid)"},{"line_number":176,"context_line":"            return"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"        LOG.debug(\u0027New state %s for partition %s\u0027, pvm_state, pvm_uuid, instance\u003dinst)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"        inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":181,"context_line":"        if inst is None:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_62e3a3da","line":178,"range":{"start_line":178,"start_character":29,"end_line":178,"end_character":31},"in_reply_to":"df140735_2e57dacc","updated":"2017-06-02 20:35:00.000000000","message":"readability/maintainability... but it\u0027s a nit, I wouldn\u0027t -1 for this.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db46c91c4dde15fa95fa1927175dece40f2a5fce","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                      \"delayed.\", pvm_uuid)"},{"line_number":176,"context_line":"            return"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"        LOG.debug(\u0027New state %s for partition %s\u0027, pvm_state, pvm_uuid, instance\u003dinst)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"        inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":181,"context_line":"        if inst is None:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_5d052210","line":178,"range":{"start_line":178,"start_character":29,"end_line":178,"end_character":31},"in_reply_to":"df140735_62e3a3da","updated":"2017-06-02 20:49:30.000000000","message":"Fair point.  In exchange for line wraps, I\u0027d rather leave it.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4f0d48e81c74e97cb7e6cc1e2ac4d6e7b392da79","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                      \"delayed.\", pvm_uuid)"},{"line_number":176,"context_line":"            return"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"        LOG.debug(\u0027New state %s for partition %s\u0027, pvm_state, pvm_uuid, instance\u003dinst)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"        inst \u003d _get_instance(inst, pvm_uuid)"},{"line_number":181,"context_line":"        if inst is None:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_2e57dacc","line":178,"range":{"start_line":178,"start_character":29,"end_line":178,"end_character":31},"in_reply_to":"df140735_94a27ead","updated":"2017-06-02 18:14:33.000000000","message":"Meh, why?  No translation.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"4959cfaf3deca11dcf22d93a53c00cd7ac631735","unresolved":false,"context_lines":[{"line_number":186,"context_line":"        # If we\u0027re in the middle of a nova-driven operation, no event necessary"},{"line_number":187,"context_line":"        if inst.task_state in self._NO_EVENT_TASK_STATES:"},{"line_number":188,"context_line":"            LOG.debug(\"Not emitting LifecycleEvent: instance task_state is %s\","},{"line_number":189,"context_line":"                      inst.task_state, instance\u003dinst)"},{"line_number":190,"context_line":"            return"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        # See if it\u0027s really a change of state from what OpenStack knows"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_8ebdcbd9","line":189,"range":{"start_line":189,"start_character":22,"end_line":189,"end_character":37},"updated":"2017-06-02 15:16:31.000000000","message":"So if you\u0027ve got this cached...can\u0027t this get pretty stale pretty quick?","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4f0d48e81c74e97cb7e6cc1e2ac4d6e7b392da79","unresolved":false,"context_lines":[{"line_number":186,"context_line":"        # If we\u0027re in the middle of a nova-driven operation, no event necessary"},{"line_number":187,"context_line":"        if inst.task_state in self._NO_EVENT_TASK_STATES:"},{"line_number":188,"context_line":"            LOG.debug(\"Not emitting LifecycleEvent: instance task_state is %s\","},{"line_number":189,"context_line":"                      inst.task_state, instance\u003dinst)"},{"line_number":190,"context_line":"            return"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        # See if it\u0027s really a change of state from what OpenStack knows"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_0e9bf665","line":189,"range":{"start_line":189,"start_character":22,"end_line":189,"end_character":37},"in_reply_to":"df140735_5fa2bffd","updated":"2017-06-02 18:14:33.000000000","message":"Better because then we know the PartitionState event came in during a _NO_EVENT_TASK_STATE.  The other way (if the get_instance happens down here), we could wind up ignoring a PartitionState event we otherwise should have handled.  That is, if the PartitionState event was triggered out of band while nova was quiescent; but by the time we get here, we\u0027re actually in a nova task.  Though even then, we probably don\u0027t want to emit the Lifecycle event.\n\nI guess the other way is slightly worse: if we were in a _NO_EVENT_TASK_STATE when the thread was queued, but we\u0027re out of it by the time we get here, we\u0027ll emit an extraneous event.  It ought to match the final state from that nova task, so no harm done - just unnecessary traffic.\n\nGiven that we don\u0027t have the ability to push the instance retrieved here back up into the cache, you\u0027re correct in that we only have a cached instance here if we handled an NVRAM event in the same process() chunk.  Which is what I\u0027m saying is kind of a pity.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"078c216dfe68d98c59561693418fc75e4abfc0d8","unresolved":false,"context_lines":[{"line_number":186,"context_line":"        # If we\u0027re in the middle of a nova-driven operation, no event necessary"},{"line_number":187,"context_line":"        if inst.task_state in self._NO_EVENT_TASK_STATES:"},{"line_number":188,"context_line":"            LOG.debug(\"Not emitting LifecycleEvent: instance task_state is %s\","},{"line_number":189,"context_line":"                      inst.task_state, instance\u003dinst)"},{"line_number":190,"context_line":"            return"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        # See if it\u0027s really a change of state from what OpenStack knows"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_994e376d","line":189,"range":{"start_line":189,"start_character":22,"end_line":189,"end_character":37},"in_reply_to":"df140735_8ebdcbd9","updated":"2017-06-02 15:58:47.000000000","message":"IF we have it cached (which in live testing it turns out we usually don\u0027t by this point - although I didn\u0027t test with NVRAM, which probably would increase the likelihood) then it represents the task state at the time we got the PowerState event.  I think that\u0027s totally appropriate - in fact, even better than when we retrieve it afresh here.  If you walk through the old code, it was logically the same thing: we got the instance right away when we got the event, passed it into the delay queue, and then used it later (in translate_event).","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":186,"context_line":"        # If we\u0027re in the middle of a nova-driven operation, no event necessary"},{"line_number":187,"context_line":"        if inst.task_state in self._NO_EVENT_TASK_STATES:"},{"line_number":188,"context_line":"            LOG.debug(\"Not emitting LifecycleEvent: instance task_state is %s\","},{"line_number":189,"context_line":"                      inst.task_state, instance\u003dinst)"},{"line_number":190,"context_line":"            return"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        # See if it\u0027s really a change of state from what OpenStack knows"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_5fa2bffd","line":189,"range":{"start_line":189,"start_character":22,"end_line":189,"end_character":37},"in_reply_to":"df140735_994e376d","updated":"2017-06-02 16:47:24.000000000","message":"Why would you say \"better\"? Should we worry about cases where the 15 second delay here allows someone time to do something in nova that moves the instance into one of the _NO_EVENT_TASK_STATES unrelated to the event we\u0027re processing?\n\nIf I\u0027m reading this right, there will only be caching in this path if NVRAM was on the same event as PartitionState. Need to make sure this is tested.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"878850effa9bf6efd05f90bfd6f8bcf0c52a5678","unresolved":false,"context_lines":[{"line_number":192,"context_line":"        # See if it\u0027s really a change of state from what OpenStack knows"},{"line_number":193,"context_line":"        transition \u003d vm.translate_event(pvm_state, inst.power_state)"},{"line_number":194,"context_line":"        if transition is None:"},{"line_number":195,"context_line":"            LOG.debug(\"No LifecycleEvent necessary for pvm_state(%s) and \""},{"line_number":196,"context_line":"                      \"power_state(%s).\", pvm_state, inst.power_state,"},{"line_number":197,"context_line":"                      instance\u003dinst)"},{"line_number":198,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_7f3d838d","line":195,"range":{"start_line":195,"start_character":65,"end_line":195,"end_character":67},"updated":"2017-06-02 16:47:24.000000000","message":"name these substitution vars","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4f0d48e81c74e97cb7e6cc1e2ac4d6e7b392da79","unresolved":false,"context_lines":[{"line_number":192,"context_line":"        # See if it\u0027s really a change of state from what OpenStack knows"},{"line_number":193,"context_line":"        transition \u003d vm.translate_event(pvm_state, inst.power_state)"},{"line_number":194,"context_line":"        if transition is None:"},{"line_number":195,"context_line":"            LOG.debug(\"No LifecycleEvent necessary for pvm_state(%s) and \""},{"line_number":196,"context_line":"                      \"power_state(%s).\", pvm_state, inst.power_state,"},{"line_number":197,"context_line":"                      instance\u003dinst)"},{"line_number":198,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":4,"id":"df140735_cea05e93","line":195,"range":{"start_line":195,"start_character":65,"end_line":195,"end_character":67},"in_reply_to":"df140735_7f3d838d","updated":"2017-06-02 18:14:33.000000000","message":"Ditto meh, no translation.","commit_id":"ee44565c8f5abf7a4d407a731ef5ba2d912bcc13"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"0bea55bb3d6b6f3ce34016a088363e59ab0e1780","unresolved":false,"context_lines":[{"line_number":27,"context_line":"from pypowervm.wrappers import event as pvm_evt"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"from nova_powervm.virt.powervm import vm"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"_LIFECYCLE_EVT_LOCK \u003d \u0027pvm_lifecycle_event\u0027"}],"source_content_type":"text/x-python","patch_set":7,"id":"df140735_22f5abed","line":30,"updated":"2017-06-02 20:34:17.000000000","message":"since you\u0027re rearranging imports... also needs a 2nd blank line after the last import","commit_id":"ded1040a439492746f92da8be7b38b8951d2e022"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"15ef68f1e3bfe571de45447a168cd0241f0e16aa","unresolved":false,"context_lines":[{"line_number":27,"context_line":"from pypowervm.wrappers import event as pvm_evt"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"from nova_powervm.virt.powervm import vm"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"_LIFECYCLE_EVT_LOCK \u003d \u0027pvm_lifecycle_event\u0027"}],"source_content_type":"text/x-python","patch_set":7,"id":"df140735_4211bf5c","line":30,"in_reply_to":"df140735_22f5abed","updated":"2017-06-02 20:49:50.000000000","message":"Done.\n\nBut note that nova doesn\u0027t care about this.  They tried flake8-import-order for a couple weeks and then got rid of it.","commit_id":"ded1040a439492746f92da8be7b38b8951d2e022"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"0bea55bb3d6b6f3ce34016a088363e59ab0e1780","unresolved":false,"context_lines":[{"line_number":118,"context_line":"                details \u003d (pvm_event.detail.split(\u0027,\u0027) if pvm_event.detail"},{"line_number":119,"context_line":"                           else [])"},{"line_number":120,"context_line":"                # Is it one we care about?"},{"line_number":121,"context_line":"                if not self.inst_actions_handled \u0026 set(details):"},{"line_number":122,"context_line":"                    continue"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"                inst \u003d self._handle_inst_event("}],"source_content_type":"text/x-python","patch_set":7,"id":"df140735_222a4b2b","line":121,"range":{"start_line":121,"start_character":28,"end_line":121,"end_character":48},"updated":"2017-06-02 20:34:17.000000000","message":"since you mentioned this earlier... upcasing this would be a good idea.","commit_id":"ded1040a439492746f92da8be7b38b8951d2e022"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"15ef68f1e3bfe571de45447a168cd0241f0e16aa","unresolved":false,"context_lines":[{"line_number":118,"context_line":"                details \u003d (pvm_event.detail.split(\u0027,\u0027) if pvm_event.detail"},{"line_number":119,"context_line":"                           else [])"},{"line_number":120,"context_line":"                # Is it one we care about?"},{"line_number":121,"context_line":"                if not self.inst_actions_handled \u0026 set(details):"},{"line_number":122,"context_line":"                    continue"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"                inst \u003d self._handle_inst_event("}],"source_content_type":"text/x-python","patch_set":7,"id":"df140735_020f4737","line":121,"range":{"start_line":121,"start_character":28,"end_line":121,"end_character":48},"in_reply_to":"df140735_222a4b2b","updated":"2017-06-02 20:49:50.000000000","message":"Done - actually moved the const-ish things to the global scope and privatized \u0027em.","commit_id":"ded1040a439492746f92da8be7b38b8951d2e022"},{"author":{"_account_id":8190,"name":"Drew Thorstensen (thorst)","email":"thorst@us.ibm.com","username":"thorst"},"change_message_id":"c7173ac90d2c189231bb77d02618e4842ace403c","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        return inst"},{"line_number":70,"context_line":"    with lockutils.lock(\u0027get_context_once\u0027):"},{"line_number":71,"context_line":"        if _CONTEXT is None:"},{"line_number":72,"context_line":"            _CONTEXT \u003d ctx.get_admin_context()"},{"line_number":73,"context_line":"    LOG.debug(\u0027PowerVM Nova Event Handler: Getting inst for id %s\u0027, pvm_uuid)"},{"line_number":74,"context_line":"    return vm.get_instance(_CONTEXT, pvm_uuid)"},{"line_number":75,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_cdb4aef4","line":72,"range":{"start_line":72,"start_character":23,"end_line":72,"end_character":46},"updated":"2017-06-05 20:14:32.000000000","message":"This may be a question for Matthew.\n\nWill this survive for days?  Beyond a keystone token expiration?","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"2d9831b1db80466965ea25367f919bbbe156d4e1","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        return inst"},{"line_number":70,"context_line":"    with lockutils.lock(\u0027get_context_once\u0027):"},{"line_number":71,"context_line":"        if _CONTEXT is None:"},{"line_number":72,"context_line":"            _CONTEXT \u003d ctx.get_admin_context()"},{"line_number":73,"context_line":"    LOG.debug(\u0027PowerVM Nova Event Handler: Getting inst for id %s\u0027, pvm_uuid)"},{"line_number":74,"context_line":"    return vm.get_instance(_CONTEXT, pvm_uuid)"},{"line_number":75,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_2dde8ad9","line":72,"range":{"start_line":72,"start_character":23,"end_line":72,"end_character":46},"in_reply_to":"df140735_cdb4aef4","updated":"2017-06-05 20:25:12.000000000","message":"Yes, there\u0027s no actual token here. https://github.com/openstack/nova/blob/stable/ocata/nova/context.py#L305-L316","commit_id":"c087a8666e87c9fd5184bafb6930467aa3821658"}]}
