)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"21bca42d1a4984b6d6d78331fc6b8e8a513170c5","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Kevin_Zheng \u003czhengzhenyu@huawei.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2018-03-22 10:12:33 -0400"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add request_id to isntance action notifications"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"As it was agreed on the Rocky PTG [1] it is useful to have the"},{"line_number":10,"context_line":"request_id of in the payload of every instance action versioned"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"df7087c5_7d958f86","line":7,"range":{"start_line":7,"start_character":18,"end_line":7,"end_character":26},"updated":"2018-03-22 14:14:10.000000000","message":"instance","commit_id":"faa44b590d062f1c9a47225f84251ab60baf5831"}],"nova/notifications/base.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"82f13c9ecfdfc163c473a24f315231a12f694d30","unresolved":false,"context_lines":[{"line_number":262,"context_line":"                    out_bytes\u003dbw[\u0027bw_out\u0027])"},{"line_number":263,"context_line":"                 for label, bw in payload[\u0027bandwidth\u0027].items()]"},{"line_number":264,"context_line":""},{"line_number":265,"context_line":"    # NOTE(Kevin_Zheng): Don\u0027t include request_id for periodic tasks,"},{"line_number":266,"context_line":"    # RequestContext for periodic tasks does not include token. Consider"},{"line_number":267,"context_line":"    # modify this once periodic tasks got a consistent request_id."},{"line_number":268,"context_line":"    req_id \u003d context.request_id if context.auth_token else None"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    versioned_payload \u003d instance_notification.InstanceUpdatePayload("},{"line_number":271,"context_line":"        instance\u003dinstance,"}],"source_content_type":"text/x-python","patch_set":20,"id":"9f6a8fd7_f03c82c0","line":268,"range":{"start_line":265,"start_character":0,"end_line":268,"end_character":63},"updated":"2018-04-19 07:55:15.000000000","message":"I think we have to move this check to the InstancePayload.__init__() as we send not just instance.update but instance.delete from periodic task. See _reclaim_queued_deletes periodic task in [1]\n\n[1] https://github.com/openstack/nova/blob/619f7c23b352653a8a77ab7209abbd2500d82a09/nova/compute/manager.py#L7273","commit_id":"0497af69d970766f1145337b46d1bec99fb1fd9a"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"e863a21b1c13c0ff99c735c467f54ff6656430b9","unresolved":false,"context_lines":[{"line_number":262,"context_line":"                    out_bytes\u003dbw[\u0027bw_out\u0027])"},{"line_number":263,"context_line":"                 for label, bw in payload[\u0027bandwidth\u0027].items()]"},{"line_number":264,"context_line":""},{"line_number":265,"context_line":"    # NOTE(Kevin_Zheng): Don\u0027t include request_id for periodic tasks,"},{"line_number":266,"context_line":"    # RequestContext for periodic tasks does not include token. Consider"},{"line_number":267,"context_line":"    # modify this once periodic tasks got a consistent request_id."},{"line_number":268,"context_line":"    req_id \u003d context.request_id if context.auth_token else None"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    versioned_payload \u003d instance_notification.InstanceUpdatePayload("},{"line_number":271,"context_line":"        instance\u003dinstance,"}],"source_content_type":"text/x-python","patch_set":20,"id":"9f6a8fd7_50152e9b","line":268,"range":{"start_line":265,"start_character":0,"end_line":268,"end_character":63},"in_reply_to":"9f6a8fd7_f03c82c0","updated":"2018-04-19 08:14:02.000000000","message":"Done","commit_id":"0497af69d970766f1145337b46d1bec99fb1fd9a"}],"nova/notifications/objects/instance.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"58d1084bb964ec97b45c952be3c99651ad2b95b0","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_b44a9452","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"updated":"2018-04-18 13:12:27.000000000","message":"Why not this one?\n\nI see this (and the one I noted below) are only used within _send_versioned_instance_update; is that significant?  We\u0027re getting the request ID from the context, and that method does take a context.  Is the request ID sometimes/never set in that code path?","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d9c304c560007ad7e767d4f61408b22c10927f2e","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_a69266f5","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"in_reply_to":"9f6a8fd7_06d6b2c4","updated":"2018-04-18 16:51:03.000000000","message":"BTW, you can tell if a context is coming from a periodic task if it doesn\u0027t have a token, like here:\n\nhttps://github.com/openstack/nova/blob/324899c621ee02d877122ba3412712ebb92831f2/nova/network/neutronv2/api.py#L161","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"82f13c9ecfdfc163c473a24f315231a12f694d30","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_55de8011","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"in_reply_to":"9f6a8fd7_3bc8a320","updated":"2018-04-19 07:55:15.000000000","message":"As far as I understand the problem goes away once [1] is merged as after [1] every service will have a stored context used for the periodic tasks so the instance.update sent from such a periodic tasks will have a distinct request_id based on the stored context. But I\u0027m OK workarouding it here now and remove the WA once [1] is merged.\n\nBTW, I found that we send instance.delete from periodic task as well [2] so this problem arises not only for instance.update. \n\n\n[1] https://review.openstack.org/#/c/524306/\n[2] https://github.com/openstack/nova/blob/619f7c23b352653a8a77ab7209abbd2500d82a09/nova/compute/manager.py#L7273","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"bcf1e2e8edba4dd85844adfa856997b4cd0d423d","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_3bc8a320","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"in_reply_to":"9f6a8fd7_93d2fd5b","updated":"2018-04-19 01:26:45.000000000","message":"Could we maybe use a specific request ID that are easy to identify for periodic tasks, rather than some random request ID which looks like a real request ID.","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"89207dc1acb6bab12563aca274da5d312c49b9e0","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_93d2fd5b","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"in_reply_to":"9f6a8fd7_a69266f5","updated":"2018-04-18 19:42:28.000000000","message":"Nice.  I did wonder about that, but assumed the request ID would be None if it was a periodic.  I guess it ain\u0027t.  Perhaps we should \"fix\" this in the context class itself...","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4e86c4c6516a0d9e81fe3ff43104028bbb606210","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_06d6b2c4","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"in_reply_to":"9f6a8fd7_b41b7419","updated":"2018-04-18 16:49:28.000000000","message":"One thing to be aware of is we\u0027re likely also generating instance update notifications for things like periodic tasks, which are using an admin context w/o a real request ID from the user. And because of the way RequestContext works, it caches a request ID in memory and re-uses it. This is why sometimes in the compute service when you\u0027re tracing a user request ID for some API-initiated operation, all of a sudden you see that request ID showing up in other unrelated things like periodic tasks which gets confusing. So I\u0027d think that if we\u0027re generating notifications based on periodic tasks, we should be careful to not include a request ID in that case since it would be misleading to consumers, just like it\u0027s misleading in the logs.\n\nSee https://review.openstack.org/#/c/524306/ for some related fun.","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"a10d47dd92b18ef7582c57cecb7eb0fb71ca8580","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":248,"context_line":"class InstanceUpdatePayload(InstancePayload):"},{"line_number":249,"context_line":"    # Version 1.0: Initial version"},{"line_number":250,"context_line":"    # Version 1.1: locked and display_description added to InstancePayload"},{"line_number":251,"context_line":"    # Version 1.2: Added tags field"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_b41b7419","line":248,"range":{"start_line":248,"start_character":6,"end_line":248,"end_character":27},"in_reply_to":"9f6a8fd7_b44a9452","updated":"2018-04-18 13:24:40.000000000","message":"I\u0027ve just did the same thinking in the last 10 minutes. The commit message calls out instance action explicitly. However I also feel that instance.update should have the request_id as well. For example adding a tag to an instance will cause an instance.update notification to be emitted and that was clearly user requested change.","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"58d1084bb964ec97b45c952be3c99651ad2b95b0","unresolved":false,"context_lines":[{"line_number":419,"context_line":""},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":422,"context_line":"class InstanceStateUpdatePayload(base.NotificationPayloadBase):"},{"line_number":423,"context_line":"    # Version 1.0: Initial version"},{"line_number":424,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":425,"context_line":"    fields \u003d {"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_f43b2cce","line":422,"range":{"start_line":422,"start_character":6,"end_line":422,"end_character":32},"updated":"2018-04-18 13:12:27.000000000","message":"Why not this one?","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"bf0bf1214f37b3b889791006d125e94e9aaa2c32","unresolved":false,"context_lines":[{"line_number":419,"context_line":""},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":422,"context_line":"class InstanceStateUpdatePayload(base.NotificationPayloadBase):"},{"line_number":423,"context_line":"    # Version 1.0: Initial version"},{"line_number":424,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":425,"context_line":"    fields \u003d {"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_5770dadc","line":422,"range":{"start_line":422,"start_character":6,"end_line":422,"end_character":32},"in_reply_to":"9f6a8fd7_14c10081","updated":"2018-04-18 14:15:50.000000000","message":"Cool.","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"a10d47dd92b18ef7582c57cecb7eb0fb71ca8580","unresolved":false,"context_lines":[{"line_number":419,"context_line":""},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"@nova_base.NovaObjectRegistry.register_notification"},{"line_number":422,"context_line":"class InstanceStateUpdatePayload(base.NotificationPayloadBase):"},{"line_number":423,"context_line":"    # Version 1.0: Initial version"},{"line_number":424,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":425,"context_line":"    fields \u003d {"}],"source_content_type":"text/x-python","patch_set":19,"id":"9f6a8fd7_14c10081","line":422,"range":{"start_line":422,"start_character":6,"end_line":422,"end_character":32},"in_reply_to":"9f6a8fd7_f43b2cce","updated":"2018-04-18 13:24:40.000000000","message":"This is a payload fragment class not directly used as a payload for a notification but used as a building block of the InstanceUpdatePayload class used in the instance.update notification as payload. So if we add the request_id to the InstanceUpdatePayload then we are good.","commit_id":"60b75f930efe8852f3d8fb000316d8b80e51d13f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"82f13c9ecfdfc163c473a24f315231a12f694d30","unresolved":false,"context_lines":[{"line_number":134,"context_line":"    VERSION \u003d \u00271.6\u0027"},{"line_number":135,"context_line":"    fields \u003d {"},{"line_number":136,"context_line":"        \u0027fault\u0027: fields.ObjectField(\u0027ExceptionPayload\u0027, nullable\u003dTrue),"},{"line_number":137,"context_line":"        \u0027request_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":138,"context_line":"    }"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    def __init__(self, instance, fault, request_id, bdms\u003dNone):"}],"source_content_type":"text/x-python","patch_set":20,"id":"9f6a8fd7_b5559c1f","line":137,"updated":"2018-04-19 07:55:15.000000000","message":"I think you should move this up to the InstancePayload as now both InstanceActionPayload and InstanceUpdatePayload has this field.","commit_id":"0497af69d970766f1145337b46d1bec99fb1fd9a"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"e863a21b1c13c0ff99c735c467f54ff6656430b9","unresolved":false,"context_lines":[{"line_number":134,"context_line":"    VERSION \u003d \u00271.6\u0027"},{"line_number":135,"context_line":"    fields \u003d {"},{"line_number":136,"context_line":"        \u0027fault\u0027: fields.ObjectField(\u0027ExceptionPayload\u0027, nullable\u003dTrue),"},{"line_number":137,"context_line":"        \u0027request_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":138,"context_line":"    }"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    def __init__(self, instance, fault, request_id, bdms\u003dNone):"}],"source_content_type":"text/x-python","patch_set":20,"id":"9f6a8fd7_9022e6ff","line":137,"in_reply_to":"9f6a8fd7_b5559c1f","updated":"2018-04-19 08:14:02.000000000","message":"Yeah, I missed this one","commit_id":"0497af69d970766f1145337b46d1bec99fb1fd9a"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"82f13c9ecfdfc163c473a24f315231a12f694d30","unresolved":false,"context_lines":[{"line_number":261,"context_line":"        \u0027bandwidth\u0027: fields.ListOfObjectsField(\u0027BandwidthPayload\u0027),"},{"line_number":262,"context_line":"        \u0027old_display_name\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":263,"context_line":"        \u0027tags\u0027: fields.ListOfStringsField(),"},{"line_number":264,"context_line":"        \u0027request_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":265,"context_line":"    }"},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"    def __init__(self, instance, state_update, audit_period, bandwidth,"}],"source_content_type":"text/x-python","patch_set":20,"id":"9f6a8fd7_353f4cd7","line":264,"updated":"2018-04-19 07:55:15.000000000","message":"See my comment in L137","commit_id":"0497af69d970766f1145337b46d1bec99fb1fd9a"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"dd3f2e62fdc36c1d065d3bdeb717d903d3870339","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        else:"},{"line_number":122,"context_line":"            self.block_devices \u003d BlockDevicePayload.from_instance(instance)"},{"line_number":123,"context_line":"        # NOTE(Kevin_Zheng): Don\u0027t include request_id for periodic tasks,"},{"line_number":124,"context_line":"        # RequestContext for periodic tasks does not include token. Consider"},{"line_number":125,"context_line":"        # modify this once periodic tasks got a consistent request_id."},{"line_number":126,"context_line":"        self.request_id \u003d context.request_id if (context.project_id and"},{"line_number":127,"context_line":"                                                 context.user_id) else None"}],"source_content_type":"text/x-python","patch_set":22,"id":"9f6a8fd7_786e1496","line":124,"range":{"start_line":124,"start_character":10,"end_line":124,"end_character":67},"updated":"2018-04-19 12:06:23.000000000","message":"Explain here that the context in the periodic task does not include auth_token and project_id, user_id. But auth_token alone is not enough to detect that this is called from a periodic task as NoAuthMiddleware also sets the auth_token to None.","commit_id":"e0ec7bab59ea8c7669ca74f99b80c83e343fc259"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c3c8e8a3cd7a8b37481ee921811f01f347a9fef","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        else:"},{"line_number":122,"context_line":"            self.block_devices \u003d BlockDevicePayload.from_instance(instance)"},{"line_number":123,"context_line":"        # NOTE(Kevin_Zheng): Don\u0027t include request_id for periodic tasks,"},{"line_number":124,"context_line":"        # RequestContext for periodic tasks does not include token. Consider"},{"line_number":125,"context_line":"        # modify this once periodic tasks got a consistent request_id."},{"line_number":126,"context_line":"        self.request_id \u003d context.request_id if (context.project_id and"},{"line_number":127,"context_line":"                                                 context.user_id) else None"}],"source_content_type":"text/x-python","patch_set":22,"id":"9f6a8fd7_d89e4053","line":124,"range":{"start_line":124,"start_character":10,"end_line":124,"end_character":67},"in_reply_to":"9f6a8fd7_786e1496","updated":"2018-04-19 12:15:36.000000000","message":"NoAuthMiddleware is only used for testing as far as I know.\n\nThis is another place in notifications where we simply check for auth_token:\n\nhttps://github.com/openstack/nova/blob/master/nova/notifications/base.py#L409","commit_id":"e0ec7bab59ea8c7669ca74f99b80c83e343fc259"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"abcd1b752ac152ec14dc11ad86ae88ce5ae1db66","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        else:"},{"line_number":122,"context_line":"            self.block_devices \u003d BlockDevicePayload.from_instance(instance)"},{"line_number":123,"context_line":"        # NOTE(Kevin_Zheng): Don\u0027t include request_id for periodic tasks,"},{"line_number":124,"context_line":"        # RequestContext for periodic tasks does not include token. Consider"},{"line_number":125,"context_line":"        # modify this once periodic tasks got a consistent request_id."},{"line_number":126,"context_line":"        self.request_id \u003d context.request_id if (context.project_id and"},{"line_number":127,"context_line":"                                                 context.user_id) else None"}],"source_content_type":"text/x-python","patch_set":22,"id":"9f6a8fd7_f828e434","line":124,"range":{"start_line":124,"start_character":10,"end_line":124,"end_character":67},"in_reply_to":"9f6a8fd7_786e1496","updated":"2018-04-19 12:07:22.000000000","message":"ah... my bad","commit_id":"e0ec7bab59ea8c7669ca74f99b80c83e343fc259"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"baf465333610d7efd53d68647beb1461657de48d","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        \u0027request_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":112,"context_line":"    }"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"    def __init__(self, instance, context, bdms\u003dNone):"},{"line_number":115,"context_line":"        super(InstancePayload, self).__init__()"},{"line_number":116,"context_line":"        network_info \u003d instance.get_network_info()"},{"line_number":117,"context_line":"        self.ip_addresses \u003d IpPayload.from_network_info(network_info)"}],"source_content_type":"text/x-python","patch_set":24,"id":"9f6a8fd7_4d558fc5","line":114,"updated":"2018-04-19 14:08:02.000000000","message":"nit: almost universally we have signatures in nova like:\n\ndef foo(self, context, instance, *args, **kwargs):\n\nSo appending context to args here and throughout in the subclasses is ugly IMO.","commit_id":"322340917854923683d838e6ba561c24a2f14a29"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"2a2e437478268c5c09429c765bc750d335d6b559","unresolved":false,"context_lines":[{"line_number":120,"context_line":"            self.block_devices \u003d BlockDevicePayload.from_bdms(bdms)"},{"line_number":121,"context_line":"        else:"},{"line_number":122,"context_line":"            self.block_devices \u003d BlockDevicePayload.from_instance(instance)"},{"line_number":123,"context_line":"        # NOTE(Kevin_Zheng): Don\u0027t include request_id for periodic tasks,"},{"line_number":124,"context_line":"        # RequestContext for periodic tasks does not include project_id"},{"line_number":125,"context_line":"        # and user_id. Consider modify this once periodic tasks got a"},{"line_number":126,"context_line":"        # consistent request_id."},{"line_number":127,"context_line":"        self.request_id \u003d context.request_id if (context.project_id and"},{"line_number":128,"context_line":"                                                 context.user_id) else None"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"        self.populate_schema(instance\u003dinstance)"},{"line_number":131,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"9f6a8fd7_6dfe53af","line":128,"range":{"start_line":123,"start_character":8,"end_line":128,"end_character":75},"updated":"2018-04-19 14:09:24.000000000","message":"I don\u0027t see a unit test for this case.","commit_id":"322340917854923683d838e6ba561c24a2f14a29"}],"nova/tests/functional/api/client.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"da9c54eda4db6db742f96e9cd33e16fc63947f08","unresolved":false,"context_lines":[{"line_number":282,"context_line":"    def put_server(self, server_id, server):"},{"line_number":283,"context_line":"        return self.api_put(\u0027/servers/%s\u0027 % server_id, server).body"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"    def post_server_action(self, server_id, data, return_full_req\u003dFalse,"},{"line_number":286,"context_line":"                           **kwargs):"},{"line_number":287,"context_line":"        response \u003d self.api_post("},{"line_number":288,"context_line":"            \u0027/servers/%s/action\u0027 % server_id, data, **kwargs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_e6c6104a","line":285,"range":{"start_line":285,"start_character":62,"end_line":285,"end_character":65},"updated":"2018-03-21 14:44:30.000000000","message":"resp","commit_id":"0037ae0d6fc5510d79d70a62c083a5ce1103b4dd"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"f043cc8e2ef8ef0cdca58fed2bbae6d48e249451","unresolved":false,"context_lines":[{"line_number":282,"context_line":"    def put_server(self, server_id, server):"},{"line_number":283,"context_line":"        return self.api_put(\u0027/servers/%s\u0027 % server_id, server).body"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"    def post_server_action(self, server_id, data, return_full_req\u003dFalse,"},{"line_number":286,"context_line":"                           **kwargs):"},{"line_number":287,"context_line":"        response \u003d self.api_post("},{"line_number":288,"context_line":"            \u0027/servers/%s/action\u0027 % server_id, data, **kwargs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_f1648ce7","line":285,"range":{"start_line":285,"start_character":62,"end_line":285,"end_character":65},"in_reply_to":"df7087c5_e6c6104a","updated":"2018-03-22 09:56:08.000000000","message":"Done","commit_id":"0037ae0d6fc5510d79d70a62c083a5ce1103b4dd"}],"nova/tests/functional/notification_sample_tests/notification_sample_base.py":[{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"c1a61dacf2a819fdc6134587ef3acd2997c2600d","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)"},{"line_number":86,"context_line":"        self.useFixture(nova_fixtures.PlacementFixture())"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"        context_patcher \u003d self.mock_gen_request_id \u003d mock.patch("},{"line_number":89,"context_line":"            \u0027oslo_context.context.generate_request_id\u0027,"},{"line_number":90,"context_line":"            return_value\u003d\u0027req-5b6c791d-5709-4f36-8fbe-c3e02869e35d\u0027)"},{"line_number":91,"context_line":"        self.mock_gen_request_id \u003d context_patcher.start()"}],"source_content_type":"text/x-python","patch_set":14,"id":"bf659307_188bd6c2","line":88,"range":{"start_line":88,"start_character":26,"end_line":88,"end_character":50},"updated":"2018-04-04 01:51:57.000000000","message":"I\u0027m not sure it\u0027s redundant or some other special use.","commit_id":"c8e959e9d6270de6d754591d1c0020d5e609df9a"}],"nova/tests/functional/notification_sample_tests/test_instance.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"9448db8b416536cb8740459753c6814fe3b174c9","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        self._wait_for_notification(\u0027instance.live_migration_rollback.end\u0027)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))"},{"line_number":84,"context_line":"        self._verify_notification("},{"line_number":85,"context_line":"            \u0027instance-live_migration_rollback-start\u0027,"},{"line_number":86,"context_line":"            replacements\u003d{"},{"line_number":87,"context_line":"                \u0027reservation_id\u0027: server[\u0027reservation_id\u0027],"},{"line_number":88,"context_line":"                \u0027uuid\u0027: server[\u0027id\u0027],"},{"line_number":89,"context_line":"                \u0027request_id\u0027: req.headers[\u0027x-compute-request-id\u0027]},"},{"line_number":90,"context_line":"            actual\u003dfake_notifier.VERSIONED_NOTIFICATIONS[0])"},{"line_number":91,"context_line":"        self._verify_notification("},{"line_number":92,"context_line":"            \u0027instance-live_migration_rollback-end\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_668d2030","line":89,"range":{"start_line":84,"start_character":8,"end_line":89,"end_character":67},"updated":"2018-03-21 14:38:32.000000000","message":"To avoid the tons of copy/paste here, could we change _verify_notification to take an optional request\u003dNone kwarg, and if passed in, it adds the replacement for request_id? Yes you\u0027d have to change all calls to _verify_notification here, but just to pass the req variable, then have _verify_notification handle the actual replacement generically.","commit_id":"0037ae0d6fc5510d79d70a62c083a5ce1103b4dd"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"7a384b507de8aaac11b7d01b98168f6f45c9b96e","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        self._wait_for_notification(\u0027instance.live_migration_rollback.end\u0027)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))"},{"line_number":84,"context_line":"        self._verify_notification("},{"line_number":85,"context_line":"            \u0027instance-live_migration_rollback-start\u0027,"},{"line_number":86,"context_line":"            replacements\u003d{"},{"line_number":87,"context_line":"                \u0027reservation_id\u0027: server[\u0027reservation_id\u0027],"},{"line_number":88,"context_line":"                \u0027uuid\u0027: server[\u0027id\u0027],"},{"line_number":89,"context_line":"                \u0027request_id\u0027: req.headers[\u0027x-compute-request-id\u0027]},"},{"line_number":90,"context_line":"            actual\u003dfake_notifier.VERSIONED_NOTIFICATIONS[0])"},{"line_number":91,"context_line":"        self._verify_notification("},{"line_number":92,"context_line":"            \u0027instance-live_migration_rollback-end\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_66e0c0cd","line":89,"range":{"start_line":84,"start_character":8,"end_line":89,"end_character":67},"in_reply_to":"df7087c5_668d2030","updated":"2018-03-21 14:42:04.000000000","message":"Sounds doable","commit_id":"0037ae0d6fc5510d79d70a62c083a5ce1103b4dd"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"bdf72b2bda9aab08764a02b190b1f5e9e36f50f0","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        self._wait_for_notification(\u0027instance.live_migration_rollback.end\u0027)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))"},{"line_number":84,"context_line":"        self._verify_notification("},{"line_number":85,"context_line":"            \u0027instance-live_migration_rollback-start\u0027,"},{"line_number":86,"context_line":"            replacements\u003d{"},{"line_number":87,"context_line":"                \u0027reservation_id\u0027: server[\u0027reservation_id\u0027],"},{"line_number":88,"context_line":"                \u0027uuid\u0027: server[\u0027id\u0027],"},{"line_number":89,"context_line":"                \u0027request_id\u0027: req.headers[\u0027x-compute-request-id\u0027]},"},{"line_number":90,"context_line":"            actual\u003dfake_notifier.VERSIONED_NOTIFICATIONS[0])"},{"line_number":91,"context_line":"        self._verify_notification("},{"line_number":92,"context_line":"            \u0027instance-live_migration_rollback-end\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_e6e92b80","line":89,"range":{"start_line":84,"start_character":8,"end_line":89,"end_character":67},"in_reply_to":"df7087c5_66e0c0cd","updated":"2018-03-21 17:10:55.000000000","message":"I had a different idea. I started from the fact that every request_id is in every response is a uniquely generated UUID. So most probably only care about the fact the a request_id is included in the notification. Therefore we can simply say request_id : ANY and this can be done once in an overriden _verify_notification() function similarly how the service version is matched in https://github.com/openstack/nova/blob/3fc1dcead76dedcc3001c71eacb9c4c0e20d65ce/nova/tests/functional/notification_sample_tests/test_service.py#L35\n\nThen I realized that we might also want to verify that the request_id returned from the instance action api call is the same as the request_id in the emitted instance action notification. As the notification consumer needed that to match things the API request with the notification. \nTo see where are the cases when the notification code path uses a different context (and therefore different request_id) than what was created by the API request, we have to match the UUID directly and cannot simply use ANY.\n\nMatt\u0027s suggestion could work but that still a lot of change as every call to  _verify_notification in this file needs to be changed. \n\nTo be able do the match in a single place, in an override of _verify_notification, without changing the signature of _verify_notification, that function should be able to figure out (or predict) what is the expected request_id. \n1) So one hackish way would be to mock the request_id generation in the functional test to generate predictable request_id-s. \n2) Anther one is to try to put the a pre-defined request_id in the request header that will end up in the RequestContext object. ( I got this idea from this code https://github.com/openstack/oslo.context/blob/c025b071305963bfbf808031bed17e27e8b4cd4b/oslo_context/context.py#L414 but I\u0027m not sure this is what I think it is)\nE.g wrap the api client in the notification test to always add a hardcoded request_id into the request header. Then use the same hardcoded request id in verify_notification. If somewhere the notification code path uses a different context than what was created by the API request it will get a generated request_id that will not match so we will detect the violations.\n\nI haven\u0027t tried to implement these ideas yet so there can be problems with the implementation :)","commit_id":"0037ae0d6fc5510d79d70a62c083a5ce1103b4dd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"69fd06c26511dc858897b1b937791f6612fa86a7","unresolved":false,"context_lines":[{"line_number":42,"context_line":"        self.useFixture(self.cinder)"},{"line_number":43,"context_line":"        self.useFixture(fixtures.AllServicesCurrent())"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"        context_patcher \u003d self.mock_gen_request_id \u003d \\"},{"line_number":46,"context_line":"            mock.patch(\u0027oslo_context.context.generate_request_id\u0027,"},{"line_number":47,"context_line":"                       return_value\u003d\u0027fake-req-id\u0027)"},{"line_number":48,"context_line":"        self.mock_gen_request_id \u003d context_patcher.start()"}],"source_content_type":"text/x-python","patch_set":12,"id":"bf659307_98510a12","line":45,"range":{"start_line":45,"start_character":53,"end_line":45,"end_character":54},"updated":"2018-03-24 00:00:13.000000000","message":"boo backslashes","commit_id":"1f4d3ba80144452ddf95249a5368dcf795d14902"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"69fd06c26511dc858897b1b937791f6612fa86a7","unresolved":false,"context_lines":[{"line_number":230,"context_line":""},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"class TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow("},{"line_number":233,"context_line":"        TestInstanceNotificationSampleWithMultipleCompute):"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"    def setUp(self):"},{"line_number":236,"context_line":"        self.flags(compute_driver\u003d\u0027fake.FakeLiveMigrateDriver\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"bf659307_f86846bb","line":233,"range":{"start_line":233,"start_character":8,"end_line":233,"end_character":57},"updated":"2018-03-24 00:00:13.000000000","message":"Won\u0027t you get the new patcher from the superclass setUp?  (In fact, it looks like a lot of the setUp code could be removed.)","commit_id":"1f4d3ba80144452ddf95249a5368dcf795d14902"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"a91bbecf12766c09e3527d1c2f9ea0685a0ee780","unresolved":false,"context_lines":[{"line_number":230,"context_line":""},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"class TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow("},{"line_number":233,"context_line":"        TestInstanceNotificationSampleWithMultipleCompute):"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"    def setUp(self):"},{"line_number":236,"context_line":"        self.flags(compute_driver\u003d\u0027fake.FakeLiveMigrateDriver\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"bf659307_71908f4f","line":233,"range":{"start_line":233,"start_character":8,"end_line":233,"end_character":57},"in_reply_to":"bf659307_f86846bb","updated":"2018-03-27 11:37:01.000000000","message":"Don\u0027t know why it didn\u0027t work, anyway, I will try the other way to do this","commit_id":"1f4d3ba80144452ddf95249a5368dcf795d14902"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"69fd06c26511dc858897b1b937791f6612fa86a7","unresolved":false,"context_lines":[{"line_number":1511,"context_line":""},{"line_number":1512,"context_line":""},{"line_number":1513,"context_line":"class TestInstanceNotificationSampleOldAttachFlow("},{"line_number":1514,"context_line":"        TestInstanceNotificationSample):"},{"line_number":1515,"context_line":""},{"line_number":1516,"context_line":"    def setUp(self):"},{"line_number":1517,"context_line":"        self.flags(use_neutron\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":12,"id":"bf659307_18665aef","line":1514,"range":{"start_line":1514,"start_character":8,"end_line":1514,"end_character":38},"updated":"2018-03-24 00:00:13.000000000","message":"ditto","commit_id":"1f4d3ba80144452ddf95249a5368dcf795d14902"}],"nova/tests/unit/notifications/objects/test_instance.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b356e0c34568b0f807163028abdd199962f2f7be","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":26,"id":"9f6a8fd7_67550c1d","line":1,"updated":"2018-04-19 17:17:41.000000000","message":"Why isn\u0027t this in test_notification.py with the other TestInstanceNotification suite?  I mean, peace with splitting instance notifications into their own file, but that other guy should come along (and all of that should be done in a separate change set).","commit_id":"94de8d75ff08bfc63d0d4a68083783b2a878508d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b6bea6d9e2905252b405cf4863b1b163925c42ca","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":26,"id":"9f6a8fd7_e2b90ae9","line":1,"in_reply_to":"9f6a8fd7_67550c1d","updated":"2018-04-19 17:36:55.000000000","message":"Because I didn\u0027t see TestInstanceNotification. +1 to move that into this module in a follow up though.","commit_id":"94de8d75ff08bfc63d0d4a68083783b2a878508d"}],"nova/tests/unit/notifications/objects/test_notification.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d3eef525857fdd325eff4d34bfee523f2c3228f3","unresolved":false,"context_lines":[{"line_number":501,"context_line":"        # Make sure that the notification payload chooses the values in"},{"line_number":502,"context_line":"        # instance.flavor.$value instead of instance.$value"},{"line_number":503,"context_line":"        mock_context \u003d mock.MagicMock()"},{"line_number":504,"context_line":"        mock_context.auth_token \u003d \u0027fake_auth_token\u0027"},{"line_number":505,"context_line":"        mock_context.request_id \u003d \u0027fake_req_id\u0027"},{"line_number":506,"context_line":"        notification_base._send_versioned_instance_update("},{"line_number":507,"context_line":"            mock_context,"}],"source_content_type":"text/x-python","patch_set":23,"id":"9f6a8fd7_3300bf01","line":504,"range":{"start_line":504,"start_character":0,"end_line":504,"end_character":51},"updated":"2018-04-19 12:31:58.000000000","message":"I guess this is not needed any more.","commit_id":"3267455257e74f0ad7d1d6db36bbc0a8b251b1ba"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"bf3b7c791bb9f9f55fa0a76c2d408e1867f86826","unresolved":false,"context_lines":[{"line_number":501,"context_line":"        # Make sure that the notification payload chooses the values in"},{"line_number":502,"context_line":"        # instance.flavor.$value instead of instance.$value"},{"line_number":503,"context_line":"        mock_context \u003d mock.MagicMock()"},{"line_number":504,"context_line":"        mock_context.auth_token \u003d \u0027fake_auth_token\u0027"},{"line_number":505,"context_line":"        mock_context.request_id \u003d \u0027fake_req_id\u0027"},{"line_number":506,"context_line":"        notification_base._send_versioned_instance_update("},{"line_number":507,"context_line":"            mock_context,"}],"source_content_type":"text/x-python","patch_set":23,"id":"9f6a8fd7_f3a56705","line":504,"range":{"start_line":504,"start_character":0,"end_line":504,"end_character":51},"in_reply_to":"9f6a8fd7_3300bf01","updated":"2018-04-19 12:36:34.000000000","message":"damn, this should be project_id and user_id now","commit_id":"3267455257e74f0ad7d1d6db36bbc0a8b251b1ba"}]}
