)]}'
{"nova/compute/manager.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c941efbc12ebe82d0e0ff05284e2e369c86762a6","unresolved":false,"context_lines":[{"line_number":472,"context_line":"        :param instance: the instance for which the event will be generated"},{"line_number":473,"context_line":"        :param event_name: the name of the event we\u0027re expecting"},{"line_number":474,"context_line":"        :returns: an event object that should be wait()\u0027d on"},{"line_number":475,"context_line":"        \"\"\""},{"line_number":476,"context_line":"        if self._events is None:"},{"line_number":477,"context_line":"            # NOTE(danms): We really should have a more specific error"},{"line_number":478,"context_line":"            # here, but this is what we use for our default error case"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_f38e1d78","line":475,"updated":"2015-07-01 19:54:14.000000000","message":"We check for None during compute service shutdown here so we don\u0027t schedule new events.","commit_id":"4beede529b7640fd520cf02be3fb8d3de394105a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c941efbc12ebe82d0e0ff05284e2e369c86762a6","unresolved":false,"context_lines":[{"line_number":504,"context_line":"        no_matching_event_sentinel \u003d object()"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":507,"context_line":"        def _pop_event():"},{"line_number":508,"context_line":"            if not self._events:"},{"line_number":509,"context_line":"                LOG.debug(\u0027Unexpected attempt to pop events during shutdown\u0027,"},{"line_number":510,"context_line":"                          instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_f3e5bd37","line":507,"updated":"2015-07-01 19:54:14.000000000","message":"And we check here on shutdown if we\u0027re attempting to pop an instance event.","commit_id":"4beede529b7640fd520cf02be3fb8d3de394105a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c941efbc12ebe82d0e0ff05284e2e369c86762a6","unresolved":false,"context_lines":[{"line_number":545,"context_line":"        \"\"\""},{"line_number":546,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":547,"context_line":"        def _clear_events():"},{"line_number":548,"context_line":"            if not self._events:"},{"line_number":549,"context_line":"                LOG.debug(\u0027Unexpected attempt to clear events\u0027,"},{"line_number":550,"context_line":"                          instance\u003dinstance)"},{"line_number":551,"context_line":"                return dict()"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_73976d3a","line":548,"updated":"2015-07-01 19:54:14.000000000","message":"If self._events is None then we know we\u0027re in the shutdown scenario, because otherwise init creates it and that happens in init of the ComputeManager class, before we\u0027d even have anything to deal with.\n\nOtherwise if self._events is just empty, {}, then I guess we just haven\u0027t called prepare_for_instance_event yet and registered the instance and the event - like someone trying to delete an instance before it\u0027s gotten to the point of waiting for instance events - like in the case of vif plugging in the libvirt driver (maybe the user deletes the instance while it\u0027s doing block device mapping or something).\n\nAnyway, this seems OK....I only see this called otherwise from resize/migrate/destroy, and I guess if something went wonky in _cleanup_running_deleted_instances.","commit_id":"4beede529b7640fd520cf02be3fb8d3de394105a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"cc4029e6c20daccf179952b24c650ec833e849d3","unresolved":false,"context_lines":[{"line_number":545,"context_line":"        \"\"\""},{"line_number":546,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":547,"context_line":"        def _clear_events():"},{"line_number":548,"context_line":"            if not self._events:"},{"line_number":549,"context_line":"                LOG.debug(\u0027Unexpected attempt to clear events\u0027,"},{"line_number":550,"context_line":"                          instance\u003dinstance)"},{"line_number":551,"context_line":"                return dict()"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_9301d16c","line":548,"in_reply_to":"ba3cc151_73976d3a","updated":"2015-07-01 19:56:46.000000000","message":"Add a simple unit test, something like this:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/tests/unit/compute/test_compute_mgr.py#n1732","commit_id":"4beede529b7640fd520cf02be3fb8d3de394105a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c941efbc12ebe82d0e0ff05284e2e369c86762a6","unresolved":false,"context_lines":[{"line_number":555,"context_line":"    def cancel_all_events(self):"},{"line_number":556,"context_line":"        our_events \u003d self._events"},{"line_number":557,"context_line":"        # NOTE(danms): Block new events"},{"line_number":558,"context_line":"        self._events \u003d None"},{"line_number":559,"context_line":""},{"line_number":560,"context_line":"        for instance_uuid, events in our_events.items():"},{"line_number":561,"context_line":"            for event_name, eventlet_event in events.items():"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_9371d1aa","line":558,"updated":"2015-07-01 19:54:14.000000000","message":"So we do set self._events to None here, and this happens on shutdown of the compute service.","commit_id":"4beede529b7640fd520cf02be3fb8d3de394105a"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c941efbc12ebe82d0e0ff05284e2e369c86762a6","unresolved":false,"context_lines":[{"line_number":1293,"context_line":"            self._update_scheduler_instance_info(context, instances)"},{"line_number":1294,"context_line":""},{"line_number":1295,"context_line":"    def cleanup_host(self):"},{"line_number":1296,"context_line":"        self.driver.register_event_listener(None)"},{"line_number":1297,"context_line":"        self.instance_events.cancel_all_events()"},{"line_number":1298,"context_line":"        self.driver.cleanup_host(host\u003dself.host)"},{"line_number":1299,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_13b5c12f","line":1296,"updated":"2015-07-01 19:54:14.000000000","message":"We start cancelling events here.","commit_id":"4beede529b7640fd520cf02be3fb8d3de394105a"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"0d561dd49c30f51ec8e30917eeaa5137148b657f","unresolved":false,"context_lines":[{"line_number":545,"context_line":"        \"\"\""},{"line_number":546,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":547,"context_line":"        def _clear_events():"},{"line_number":548,"context_line":"            if not self._events:"},{"line_number":549,"context_line":"                LOG.debug(\u0027Unexpected attempt to clear events\u0027,"},{"line_number":550,"context_line":"                          instance\u003dinstance)"},{"line_number":551,"context_line":"                return dict()"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_911be680","line":548,"updated":"2015-07-02 13:53:46.000000000","message":"Do you mean to check if self._events is None? Won\u0027t this complain even if we have no events (i.e. a falsey dict) ?","commit_id":"b27449a5d6fa89fcb27fdce086b45e55a8302e7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"158e12d9095358ec4f60726c5e931ce4917a1d64","unresolved":false,"context_lines":[{"line_number":545,"context_line":"        \"\"\""},{"line_number":546,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":547,"context_line":"        def _clear_events():"},{"line_number":548,"context_line":"            if not self._events:"},{"line_number":549,"context_line":"                LOG.debug(\u0027Unexpected attempt to clear events\u0027,"},{"line_number":550,"context_line":"                          instance\u003dinstance)"},{"line_number":551,"context_line":"                return dict()"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_923d21df","line":548,"in_reply_to":"ba3cc151_1c060d52","updated":"2015-07-02 15:16:49.000000000","message":"Yeah, as discussed in IRC it needs to be a None check since the only time we should reasonably expect to hit that is a race with shutting down the service.  Anything else is unexpected and we don\u0027t want to mask that.","commit_id":"b27449a5d6fa89fcb27fdce086b45e55a8302e7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a06782037b85a7df44fa4091c287efb880d79db9","unresolved":false,"context_lines":[{"line_number":545,"context_line":"        \"\"\""},{"line_number":546,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":547,"context_line":"        def _clear_events():"},{"line_number":548,"context_line":"            if not self._events:"},{"line_number":549,"context_line":"                LOG.debug(\u0027Unexpected attempt to clear events\u0027,"},{"line_number":550,"context_line":"                          instance\u003dinstance)"},{"line_number":551,"context_line":"                return dict()"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_1c060d52","line":548,"in_reply_to":"ba3cc151_911be680","updated":"2015-07-02 14:03:46.000000000","message":"I commented on this in patch set 1.  In the bug people also reported hitting this when deleting an instance.  The None case is when the compute service is shutting down.  But I\u0027m wondering if there is a race where an instance delete request is made before _events has an entry in it for an instance that\u0027s spawning.","commit_id":"b27449a5d6fa89fcb27fdce086b45e55a8302e7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"85d32e20e2be796423330e43290928f088a5d093","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        @utils.synchronized(self._lock_name(instance))"},{"line_number":547,"context_line":"        def _clear_events():"},{"line_number":548,"context_line":"            if self._events is None:"},{"line_number":549,"context_line":"                LOG.debug(\u0027Unexpected attempt to clear events\u0027,"},{"line_number":550,"context_line":"                          instance\u003dinstance)"},{"line_number":551,"context_line":"                return dict()"},{"line_number":552,"context_line":"            return self._events.pop(instance.uuid, {})"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_889bb465","line":549,"updated":"2015-07-02 15:39:16.000000000","message":"Add \u0027during shutdown\u0027 here like we see on line 509 since we\u0027re only expecting to handle this during the shutdown case.","commit_id":"d5e9678d3d7333915c9ec1b5d8f840ae792c0ea9"}]}
