)]}'
{"nova/objects/instance.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fbcba5eb933004d6a0e7ac4b866fa7ec67fd9256","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        # down to the DB layer (which uses an integer), we can always"},{"line_number":490,"context_line":"        # default it to zero here."},{"line_number":491,"context_line":"        updates[\u0027deleted\u0027] \u003d 0"},{"line_number":492,"context_line":"        # NOTE(sneti): tags is set to empty list so that it is added to"},{"line_number":493,"context_line":"        # expected_attrs below. This avoids lazy loading of tags attribute"},{"line_number":494,"context_line":"        # when versioned notification is sent during instance create."},{"line_number":495,"context_line":"        updates[\u0027tags\u0027] \u003d []"},{"line_number":496,"context_line":""},{"line_number":497,"context_line":"        expected_attrs \u003d [attr for attr in INSTANCE_DEFAULT_FIELDS"},{"line_number":498,"context_line":"                          if attr in updates]"},{"line_number":499,"context_line":"        if \u0027security_groups\u0027 in updates:"},{"line_number":500,"context_line":"            updates[\u0027security_groups\u0027] \u003d [x.name for x in"},{"line_number":501,"context_line":"                                          updates[\u0027security_groups\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_048df97a","line":498,"range":{"start_line":492,"start_character":0,"end_line":498,"end_character":45},"updated":"2017-02-22 15:27:59.000000000","message":"Can we just simply remove the \u0027if attr in updates\u0027 condition? I don\u0027t see any reason it is needed there.","commit_id":"3a9ed7846e297ce6151b34f66de6bc0829cf6b8e"},{"author":{"_account_id":18337,"name":"Sujitha","email":"sujitha.neti@intel.com","username":"Sujitha"},"change_message_id":"450f739f6be4122da5aac433cc739543a8d63776","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        # down to the DB layer (which uses an integer), we can always"},{"line_number":490,"context_line":"        # default it to zero here."},{"line_number":491,"context_line":"        updates[\u0027deleted\u0027] \u003d 0"},{"line_number":492,"context_line":"        # NOTE(sneti): tags is set to empty list so that it is added to"},{"line_number":493,"context_line":"        # expected_attrs below. This avoids lazy loading of tags attribute"},{"line_number":494,"context_line":"        # when versioned notification is sent during instance create."},{"line_number":495,"context_line":"        updates[\u0027tags\u0027] \u003d []"},{"line_number":496,"context_line":""},{"line_number":497,"context_line":"        expected_attrs \u003d [attr for attr in INSTANCE_DEFAULT_FIELDS"},{"line_number":498,"context_line":"                          if attr in updates]"},{"line_number":499,"context_line":"        if \u0027security_groups\u0027 in updates:"},{"line_number":500,"context_line":"            updates[\u0027security_groups\u0027] \u003d [x.name for x in"},{"line_number":501,"context_line":"                                          updates[\u0027security_groups\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_935da47b","line":498,"range":{"start_line":492,"start_character":0,"end_line":498,"end_character":45},"in_reply_to":"da36d5c6_048df97a","updated":"2017-02-23 16:45:23.000000000","message":"gibi, If we just add tags to expected_attrs without setting value, then from_db_object() on L555 tries to load tags attribute from db giving below error as it is not bound to a session.\n\nsqlalchemy.orm.exc.DetachedInstanceError: Parent instance  is not bound to a Session; lazy load operation of attribute \u0027tags\u0027 cannot proceed.\n\nhttps://github.com/openstack/nova/blob/master/nova/objects/instance.py#L435-L438\n\nI think it is necessary to set tags before adding it to expected_attrs.","commit_id":"3a9ed7846e297ce6151b34f66de6bc0829cf6b8e"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fbcba5eb933004d6a0e7ac4b866fa7ec67fd9256","unresolved":false,"context_lines":[{"line_number":1069,"context_line":"            # filters on instances.deleted \u003d\u003d 0, so if the instance is deleted"},{"line_number":1070,"context_line":"            # don\u0027t attempt to even load services since we\u0027ll fail."},{"line_number":1071,"context_line":"            self.services \u003d objects.ServiceList(self._context)"},{"line_number":1072,"context_line":"        elif attrname \u003d\u003d \u0027tags\u0027:"},{"line_number":1073,"context_line":"            if self.deleted:"},{"line_number":1074,"context_line":"                # NOTE(mriedem): Same story as services, the DB API query"},{"line_number":1075,"context_line":"                # in instance_tag_get_by_instance_uuid will fail if the"},{"line_number":1076,"context_line":"                # instance has been deleted so just return an empty tag list."},{"line_number":1077,"context_line":"                self.tags \u003d objects.TagList(self._context)"},{"line_number":1078,"context_line":"            else:"},{"line_number":1079,"context_line":"                self._load_tags()"},{"line_number":1080,"context_line":"        else:"},{"line_number":1081,"context_line":"            # FIXME(comstud): This should be optimized to only load the attr."},{"line_number":1082,"context_line":"            self._load_generic(attrname)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_c41cc115","line":1079,"range":{"start_line":1072,"start_character":0,"end_line":1079,"end_character":33},"updated":"2017-02-22 15:27:59.000000000","message":"Is this still necessary after made tags loaded by default?","commit_id":"3a9ed7846e297ce6151b34f66de6bc0829cf6b8e"},{"author":{"_account_id":18337,"name":"Sujitha","email":"sujitha.neti@intel.com","username":"Sujitha"},"change_message_id":"450f739f6be4122da5aac433cc739543a8d63776","unresolved":false,"context_lines":[{"line_number":1069,"context_line":"            # filters on instances.deleted \u003d\u003d 0, so if the instance is deleted"},{"line_number":1070,"context_line":"            # don\u0027t attempt to even load services since we\u0027ll fail."},{"line_number":1071,"context_line":"            self.services \u003d objects.ServiceList(self._context)"},{"line_number":1072,"context_line":"        elif attrname \u003d\u003d \u0027tags\u0027:"},{"line_number":1073,"context_line":"            if self.deleted:"},{"line_number":1074,"context_line":"                # NOTE(mriedem): Same story as services, the DB API query"},{"line_number":1075,"context_line":"                # in instance_tag_get_by_instance_uuid will fail if the"},{"line_number":1076,"context_line":"                # instance has been deleted so just return an empty tag list."},{"line_number":1077,"context_line":"                self.tags \u003d objects.TagList(self._context)"},{"line_number":1078,"context_line":"            else:"},{"line_number":1079,"context_line":"                self._load_tags()"},{"line_number":1080,"context_line":"        else:"},{"line_number":1081,"context_line":"            # FIXME(comstud): This should be optimized to only load the attr."},{"line_number":1082,"context_line":"            self._load_generic(attrname)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_010cd939","line":1079,"range":{"start_line":1072,"start_character":0,"end_line":1079,"end_character":33},"in_reply_to":"da36d5c6_c41cc115","updated":"2017-02-23 16:45:23.000000000","message":"removing this.","commit_id":"3a9ed7846e297ce6151b34f66de6bc0829cf6b8e"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"548a00e81ad538c61272fc8ac185d45aecfe593a","unresolved":false,"context_lines":[{"line_number":1065,"context_line":"            # filters on instances.deleted \u003d\u003d 0, so if the instance is deleted"},{"line_number":1066,"context_line":"            # don\u0027t attempt to even load services since we\u0027ll fail."},{"line_number":1067,"context_line":"            self.services \u003d objects.ServiceList(self._context)"},{"line_number":1068,"context_line":"        elif attrname \u003d\u003d \u0027tags\u0027:"},{"line_number":1069,"context_line":"            if self.deleted:"},{"line_number":1070,"context_line":"                # NOTE(mriedem): Same story as services, the DB API query"},{"line_number":1071,"context_line":"                # in instance_tag_get_by_instance_uuid will fail if the"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a30ddce_2fcce834","side":"PARENT","line":1068,"updated":"2017-03-07 16:18:13.000000000","message":"We still could lazy load tags in the code, so I don\u0027t think its safe to remove this right now.\n\nEither way, lets look at doing that in a separate patch.","commit_id":"8fdd66d6144363e06ad95322aec3cafc391012f0"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"548a00e81ad538c61272fc8ac185d45aecfe593a","unresolved":false,"context_lines":[{"line_number":341,"context_line":"            expected_attrs \u003d []"},{"line_number":342,"context_line":"        # Most of the field names match right now, so be quick"},{"line_number":343,"context_line":"        for field in instance.fields:"},{"line_number":344,"context_line":"            if field in INSTANCE_OPTIONAL_ATTRS:"},{"line_number":345,"context_line":"                continue"},{"line_number":346,"context_line":"            elif field \u003d\u003d \u0027deleted\u0027:"},{"line_number":347,"context_line":"                instance.deleted \u003d db_inst[\u0027deleted\u0027] \u003d\u003d db_inst[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a30ddce_2f4f8893","line":344,"updated":"2017-03-07 16:18:13.000000000","message":"so we do skip loading tags here, and fall back to the info below.","commit_id":"a35e536bb29e281337084a661c0031eab4d6ed39"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"548a00e81ad538c61272fc8ac185d45aecfe593a","unresolved":false,"context_lines":[{"line_number":432,"context_line":"                    objects.SecurityGroup, db_inst.get(\u0027security_groups\u0027, []))"},{"line_number":433,"context_line":"            instance[\u0027security_groups\u0027] \u003d sec_groups"},{"line_number":434,"context_line":""},{"line_number":435,"context_line":"        if \u0027tags\u0027 in expected_attrs:"},{"line_number":436,"context_line":"            tags \u003d base.obj_make_list("},{"line_number":437,"context_line":"                context, objects.TagList(context),"},{"line_number":438,"context_line":"                objects.Tag, db_inst[\u0027tags\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a30ddce_6f49808b","line":435,"updated":"2017-03-07 16:18:13.000000000","message":"I think this means lazy load is still possible.\n\nI suspect this line in cells causes the problem. Probably its this that triggers the tags lazy loads:\nhttps://github.com/openstack/nova/blob/master/nova/cells/messaging.py#L661","commit_id":"a35e536bb29e281337084a661c0031eab4d6ed39"}]}
