)]}'
{"blazar/monitor/base.py":[{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"ff4b82b355b81f579f5c889f27da1b35c85a4632","unresolved":false,"context_lines":[{"line_number":58,"context_line":"            reservation \u003d db_api.reservation_get(reservation_id)"},{"line_number":59,"context_line":"            lease_ids.add(reservation[\u0027lease_id\u0027])"},{"line_number":60,"context_line":"        for lease_id in lease_ids:"},{"line_number":61,"context_line":"            LOG.debug(\u0027Lease %s was updated: {\\\u0027degraded\\\u0027: True}\u0027, lease_id)"},{"line_number":62,"context_line":"            db_api.lease_update(lease_id, {\u0027degraded\u0027: True})"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_4742d010","line":61,"range":{"start_line":61,"start_character":46,"end_line":61,"end_character":58},"updated":"2017-12-12 11:20:15.000000000","message":"Use double-quote instead of single-quote","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":58,"context_line":"            reservation \u003d db_api.reservation_get(reservation_id)"},{"line_number":59,"context_line":"            lease_ids.add(reservation[\u0027lease_id\u0027])"},{"line_number":60,"context_line":"        for lease_id in lease_ids:"},{"line_number":61,"context_line":"            LOG.debug(\u0027Lease %s was updated: {\\\u0027degraded\\\u0027: True}\u0027, lease_id)"},{"line_number":62,"context_line":"            db_api.lease_update(lease_id, {\u0027degraded\u0027: True})"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_eafdd6b1","line":61,"range":{"start_line":61,"start_character":46,"end_line":61,"end_character":58},"in_reply_to":"df87a7cf_4742d010","updated":"2017-12-13 02:43:36.000000000","message":"Done","commit_id":"46c09742a1039434183dd773d11872f15279eed6"}],"blazar/plugins/instances/instance_plugin.py":[{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"340e12e951d45fb4316c3a8a8458018ca1abc14c","unresolved":false,"context_lines":[{"line_number":466,"context_line":""},{"line_number":467,"context_line":"        self.cleanup_resources(instance_reservation)"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":"    @classmethod"},{"line_number":470,"context_line":"    def heal_reservations(cls, failed_resources):"},{"line_number":471,"context_line":"        \"\"\"Heal reservations which suffer from resource failures."},{"line_number":472,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"7f96bb07_43eb14db","line":469,"range":{"start_line":469,"start_character":0,"end_line":469,"end_character":16},"updated":"2018-01-16 07:03:26.000000000","message":"I think it\u0027s not need to be a classmethod.","commit_id":"4cf52426c120168e0d626a2beec282bf4a322f20"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2ee63068094861347f5f07f8515115fb887b8086","unresolved":false,"context_lines":[{"line_number":466,"context_line":""},{"line_number":467,"context_line":"        self.cleanup_resources(instance_reservation)"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":"    @classmethod"},{"line_number":470,"context_line":"    def heal_reservations(cls, failed_resources):"},{"line_number":471,"context_line":"        \"\"\"Heal reservations which suffer from resource failures."},{"line_number":472,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"7f96bb07_0d543652","line":469,"range":{"start_line":469,"start_character":0,"end_line":469,"end_character":16},"in_reply_to":"7f96bb07_43eb14db","updated":"2018-01-17 04:37:08.000000000","message":"Done","commit_id":"4cf52426c120168e0d626a2beec282bf4a322f20"}],"blazar/plugins/oshosts/host_plugin.py":[{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"ff4b82b355b81f579f5c889f27da1b35c85a4632","unresolved":false,"context_lines":[{"line_number":90,"context_line":"            user_domain_name\u003dCONF.os_admin_user_domain_name,"},{"line_number":91,"context_line":"            project_name\u003dCONF.os_admin_project_name,"},{"line_number":92,"context_line":"            project_domain_name\u003dCONF.os_admin_user_domain_name)"},{"line_number":93,"context_line":"        self.monitor \u003d PhysicalHostMonitorPlugin()"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"    def reserve_resource(self, reservation_id, values):"},{"line_number":96,"context_line":"        \"\"\"Create reservation.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_87cc5835","line":93,"updated":"2017-12-12 11:20:15.000000000","message":"If you pass \u0027self\u0027 here for the plugin, the plugin can call instance method instead of class method.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":90,"context_line":"            user_domain_name\u003dCONF.os_admin_user_domain_name,"},{"line_number":91,"context_line":"            project_name\u003dCONF.os_admin_project_name,"},{"line_number":92,"context_line":"            project_domain_name\u003dCONF.os_admin_user_domain_name)"},{"line_number":93,"context_line":"        self.monitor \u003d PhysicalHostMonitorPlugin()"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"    def reserve_resource(self, reservation_id, values):"},{"line_number":96,"context_line":"        \"\"\"Create reservation.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_d64a02ab","line":93,"in_reply_to":"df87a7cf_87cc5835","updated":"2017-12-13 02:43:36.000000000","message":"Done","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":15197,"name":"Pierre Riteau","email":"pierre@stackhpc.com","username":"priteau","status":"StackHPC"},"change_message_id":"78365163b199251641d920d0617b2658690aed47","unresolved":false,"context_lines":[{"line_number":234,"context_line":"            new_hostids \u003d cls._matching_hosts("},{"line_number":235,"context_line":"                reservation[\u0027hypervisor_properties\u0027],"},{"line_number":236,"context_line":"                reservation[\u0027resource_properties\u0027],"},{"line_number":237,"context_line":"                \u00271-1\u0027, lease[\u0027start_date\u0027], lease[\u0027end_date\u0027]"},{"line_number":238,"context_line":"            )"},{"line_number":239,"context_line":"            if not new_hostids:"},{"line_number":240,"context_line":"                reservation_flags.update("}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_277c6c70","line":237,"range":{"start_line":237,"start_character":23,"end_line":237,"end_character":42},"updated":"2017-12-12 10:52:06.000000000","message":"If I understand correctly, heal_reservations() can be called while a lease is active. In that case, we should not be looking for a host available from lease[\u0027start_date\u0027], but from the current time instead.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":234,"context_line":"            new_hostids \u003d cls._matching_hosts("},{"line_number":235,"context_line":"                reservation[\u0027hypervisor_properties\u0027],"},{"line_number":236,"context_line":"                reservation[\u0027resource_properties\u0027],"},{"line_number":237,"context_line":"                \u00271-1\u0027, lease[\u0027start_date\u0027], lease[\u0027end_date\u0027]"},{"line_number":238,"context_line":"            )"},{"line_number":239,"context_line":"            if not new_hostids:"},{"line_number":240,"context_line":"                reservation_flags.update("}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_1bd653c5","line":237,"range":{"start_line":237,"start_character":23,"end_line":237,"end_character":42},"in_reply_to":"df87a7cf_277c6c70","updated":"2017-12-13 02:43:36.000000000","message":"Thanks for pointing it out! I\u0027ve changed here to use current time if the lease has already started.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"ff4b82b355b81f579f5c889f27da1b35c85a4632","unresolved":false,"context_lines":[{"line_number":601,"context_line":"            project_name\u003dCONF.os_admin_project_name,"},{"line_number":602,"context_line":"            project_domain_name\u003dCONF.os_admin_user_domain_name)"},{"line_number":603,"context_line":"        self.healing_handlers \u003d ["},{"line_number":604,"context_line":"            PhysicalHostPlugin.heal_reservations,"},{"line_number":605,"context_line":"            instance_plugin.VirtualInstancePlugin.heal_reservations"},{"line_number":606,"context_line":"        ]"},{"line_number":607,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_c7f6e05d","line":604,"range":{"start_line":604,"start_character":12,"end_line":604,"end_character":49},"updated":"2017-12-12 11:20:15.000000000","message":"This class receives hostplugin class as I commented above, then this can call the instance method.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":601,"context_line":"            project_name\u003dCONF.os_admin_project_name,"},{"line_number":602,"context_line":"            project_domain_name\u003dCONF.os_admin_user_domain_name)"},{"line_number":603,"context_line":"        self.healing_handlers \u003d ["},{"line_number":604,"context_line":"            PhysicalHostPlugin.heal_reservations,"},{"line_number":605,"context_line":"            instance_plugin.VirtualInstancePlugin.heal_reservations"},{"line_number":606,"context_line":"        ]"},{"line_number":607,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_7677760a","line":604,"range":{"start_line":604,"start_character":12,"end_line":604,"end_character":49},"in_reply_to":"df87a7cf_c7f6e05d","updated":"2017-12-13 02:43:36.000000000","message":"I\u0027ve applied a Singleton pattern to this class because it\u0027s shared by the host plugin and the instance plugin. Each plug in can register the healing method by using a new register_healing_handler method.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"ff4b82b355b81f579f5c889f27da1b35c85a4632","unresolved":false,"context_lines":[{"line_number":602,"context_line":"            project_domain_name\u003dCONF.os_admin_user_domain_name)"},{"line_number":603,"context_line":"        self.healing_handlers \u003d ["},{"line_number":604,"context_line":"            PhysicalHostPlugin.heal_reservations,"},{"line_number":605,"context_line":"            instance_plugin.VirtualInstancePlugin.heal_reservations"},{"line_number":606,"context_line":"        ]"},{"line_number":607,"context_line":""},{"line_number":608,"context_line":"    def is_notification_enabled(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_078608ba","line":605,"range":{"start_line":605,"start_character":1,"end_line":605,"end_character":67},"updated":"2017-12-12 11:20:15.000000000","message":"I don\u0027t think it need to support this since the instance reservation class doesn\u0027t support heal_reservation now.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":602,"context_line":"            project_domain_name\u003dCONF.os_admin_user_domain_name)"},{"line_number":603,"context_line":"        self.healing_handlers \u003d ["},{"line_number":604,"context_line":"            PhysicalHostPlugin.heal_reservations,"},{"line_number":605,"context_line":"            instance_plugin.VirtualInstancePlugin.heal_reservations"},{"line_number":606,"context_line":"        ]"},{"line_number":607,"context_line":""},{"line_number":608,"context_line":"    def is_notification_enabled(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_76c5360a","line":605,"range":{"start_line":605,"start_character":1,"end_line":605,"end_character":67},"in_reply_to":"df87a7cf_078608ba","updated":"2017-12-13 02:43:36.000000000","message":"Done","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":15197,"name":"Pierre Riteau","email":"pierre@stackhpc.com","username":"priteau","status":"StackHPC"},"change_message_id":"1589a5f9129a1cc14f8cb9f3184a6442585afad4","unresolved":false,"context_lines":[{"line_number":649,"context_line":"                 e.g. {\u0027de27786d-bd96-46bb-8363-19c13b2c6657\u0027:"},{"line_number":650,"context_line":"                 {\u0027missing_resources\u0027: True}}"},{"line_number":651,"context_line":"        \"\"\""},{"line_number":652,"context_line":"        LOG.debug(\u0027Poll...\u0027)"},{"line_number":653,"context_line":"        reservation_flags \u003d {}"},{"line_number":654,"context_line":""},{"line_number":655,"context_line":"        failed_hosts \u003d self._poll_resource_failures()"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_673034a0","line":652,"range":{"start_line":652,"start_character":0,"end_line":652,"end_character":28},"updated":"2017-12-12 10:55:54.000000000","message":"I am afraid this log statement will make debug logs harder to use because there might be many of them and they don\u0027t provide any information. Maybe move it to the trace level instead?","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":649,"context_line":"                 e.g. {\u0027de27786d-bd96-46bb-8363-19c13b2c6657\u0027:"},{"line_number":650,"context_line":"                 {\u0027missing_resources\u0027: True}}"},{"line_number":651,"context_line":"        \"\"\""},{"line_number":652,"context_line":"        LOG.debug(\u0027Poll...\u0027)"},{"line_number":653,"context_line":"        reservation_flags \u003d {}"},{"line_number":654,"context_line":""},{"line_number":655,"context_line":"        failed_hosts \u003d self._poll_resource_failures()"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_d68d22d4","line":652,"range":{"start_line":652,"start_character":0,"end_line":652,"end_character":28},"in_reply_to":"df87a7cf_673034a0","updated":"2017-12-13 02:43:36.000000000","message":"Done","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"ff4b82b355b81f579f5c889f27da1b35c85a4632","unresolved":false,"context_lines":[{"line_number":670,"context_line":"        for host in hosts:"},{"line_number":671,"context_line":"            with trusts.create_ctx_from_trust(host[\u0027trust_id\u0027]):"},{"line_number":672,"context_line":"                try:"},{"line_number":673,"context_line":"                    hv \u003d self.nova.hypervisors.get(host[\u0027id\u0027])"},{"line_number":674,"context_line":"                    LOG.debug(\u0027%s: state\u003d%s, status\u003d%s.\u0027,"},{"line_number":675,"context_line":"                              hv.hypervisor_hostname, hv.state, hv.status)"},{"line_number":676,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_67083491","line":673,"range":{"start_line":673,"start_character":0,"end_line":673,"end_character":62},"updated":"2017-12-12 11:20:15.000000000","message":"Can we get hypervisor list with details instead of calling hypervosor get?  It can reduce the number of API call for Nova.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":670,"context_line":"        for host in hosts:"},{"line_number":671,"context_line":"            with trusts.create_ctx_from_trust(host[\u0027trust_id\u0027]):"},{"line_number":672,"context_line":"                try:"},{"line_number":673,"context_line":"                    hv \u003d self.nova.hypervisors.get(host[\u0027id\u0027])"},{"line_number":674,"context_line":"                    LOG.debug(\u0027%s: state\u003d%s, status\u003d%s.\u0027,"},{"line_number":675,"context_line":"                              hv.hypervisor_hostname, hv.state, hv.status)"},{"line_number":676,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_0a491a31","line":673,"range":{"start_line":673,"start_character":0,"end_line":673,"end_character":62},"in_reply_to":"df87a7cf_67083491","updated":"2017-12-13 02:43:36.000000000","message":"Agree. Can I deal with it in another patch not to stop reviews of other parts? I plan to change context (L671) with this change and I need time for testing it.","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":15197,"name":"Pierre Riteau","email":"pierre@stackhpc.com","username":"priteau","status":"StackHPC"},"change_message_id":"78365163b199251641d920d0617b2658690aed47","unresolved":false,"context_lines":[{"line_number":676,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"},{"line_number":677,"context_line":"                        failed_hosts.append(host)"},{"line_number":678,"context_line":"                except Exception as e:"},{"line_number":679,"context_line":"                    LOG.exception(\u0027Skip health-checking %s. %s\u0027,"},{"line_number":680,"context_line":"                                  host[\u0027hypervisor_hostname\u0027], e.message)"},{"line_number":681,"context_line":""},{"line_number":682,"context_line":"        return failed_hosts"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_a7e4fc3c","line":679,"range":{"start_line":679,"start_character":35,"end_line":679,"end_character":58},"updated":"2017-12-12 10:52:06.000000000","message":"I would say instead:\n\nSkipping health check of host %s","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2217ea9490af6e5c2d73214ac5ec794aec7a83f6","unresolved":false,"context_lines":[{"line_number":676,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"},{"line_number":677,"context_line":"                        failed_hosts.append(host)"},{"line_number":678,"context_line":"                except Exception as e:"},{"line_number":679,"context_line":"                    LOG.exception(\u0027Skip health-checking %s. %s\u0027,"},{"line_number":680,"context_line":"                                  host[\u0027hypervisor_hostname\u0027], e.message)"},{"line_number":681,"context_line":""},{"line_number":682,"context_line":"        return failed_hosts"}],"source_content_type":"text/x-python","patch_set":4,"id":"df87a7cf_16adca30","line":679,"range":{"start_line":679,"start_character":35,"end_line":679,"end_character":58},"in_reply_to":"df87a7cf_a7e4fc3c","updated":"2017-12-13 02:43:36.000000000","message":"Done","commit_id":"46c09742a1039434183dd773d11872f15279eed6"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"e4277d248b32716ce3d75528961b0f426b808d68","unresolved":false,"context_lines":[{"line_number":208,"context_line":"        except manager_ex.AggregateNotFound:"},{"line_number":209,"context_line":"            pass"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"    @classmethod"},{"line_number":212,"context_line":"    def heal_reservations(cls, failed_resources):"},{"line_number":213,"context_line":"        \"\"\"Heal reservations which suffer from resource failures."},{"line_number":214,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_5a41b938","line":211,"range":{"start_line":211,"start_character":0,"end_line":211,"end_character":16},"updated":"2017-12-18 10:12:37.000000000","message":"Why the class is still classmethod?","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"9ba8f6412f0f92415af575100e2aceec9a8ffdf6","unresolved":false,"context_lines":[{"line_number":208,"context_line":"        except manager_ex.AggregateNotFound:"},{"line_number":209,"context_line":"            pass"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"    @classmethod"},{"line_number":212,"context_line":"    def heal_reservations(cls, failed_resources):"},{"line_number":213,"context_line":"        \"\"\"Heal reservations which suffer from resource failures."},{"line_number":214,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_b9afa128","line":211,"range":{"start_line":211,"start_character":0,"end_line":211,"end_character":16},"in_reply_to":"df87a7cf_5a41b938","updated":"2017-12-19 04:14:57.000000000","message":"Oops. I was careless, sorry.","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"e4277d248b32716ce3d75528961b0f426b808d68","unresolved":false,"context_lines":[{"line_number":229,"context_line":"            if reservation[\u0027resource_type\u0027] !\u003d plugin.RESOURCE_TYPE:"},{"line_number":230,"context_line":"                continue"},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"            # Delete failed allocation."},{"line_number":233,"context_line":"            db_api.host_allocation_destroy(alloc[\u0027id\u0027])"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"            # Allocate alternative resource."},{"line_number":236,"context_line":"            lease \u003d db_api.lease_get(reservation[\u0027lease_id\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_baeb2576","line":233,"range":{"start_line":232,"start_character":0,"end_line":233,"end_character":55},"updated":"2017-12-18 10:12:37.000000000","message":"It\u0027s good to delete the allocation only if there is no new_hostids. No one can\u0027t track the change if blazar-manager goes down in L234-242.\n\nI suggest to move it to L245.","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"9ba8f6412f0f92415af575100e2aceec9a8ffdf6","unresolved":false,"context_lines":[{"line_number":229,"context_line":"            if reservation[\u0027resource_type\u0027] !\u003d plugin.RESOURCE_TYPE:"},{"line_number":230,"context_line":"                continue"},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"            # Delete failed allocation."},{"line_number":233,"context_line":"            db_api.host_allocation_destroy(alloc[\u0027id\u0027])"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"            # Allocate alternative resource."},{"line_number":236,"context_line":"            lease \u003d db_api.lease_get(reservation[\u0027lease_id\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_54741c36","line":233,"range":{"start_line":232,"start_character":0,"end_line":233,"end_character":55},"in_reply_to":"df87a7cf_baeb2576","updated":"2017-12-19 04:14:57.000000000","message":"Done","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"e4277d248b32716ce3d75528961b0f426b808d68","unresolved":false,"context_lines":[{"line_number":247,"context_line":"                         \u0027(lease: %s).\u0027, reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":248,"context_line":"            else:"},{"line_number":249,"context_line":"                new_hostid \u003d new_hostids.pop()"},{"line_number":250,"context_line":"                db_api.host_allocation_create("},{"line_number":251,"context_line":"                    {\u0027compute_host_id\u0027: new_hostid,"},{"line_number":252,"context_line":"                     \u0027reservation_id\u0027: reservation[\u0027id\u0027]})"},{"line_number":253,"context_line":"                if reservation[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":254,"context_line":"                    # Add the alternative host into the aggregate."},{"line_number":255,"context_line":"                    host_reservation \u003d db_api.host_reservation_get("}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_e58a6e19","line":252,"range":{"start_line":250,"start_character":0,"end_line":252,"end_character":58},"updated":"2017-12-18 10:12:37.000000000","message":"It\u0027s good to use host_allocation_update for new_hostid instead of creating a new record.","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"9ba8f6412f0f92415af575100e2aceec9a8ffdf6","unresolved":false,"context_lines":[{"line_number":247,"context_line":"                         \u0027(lease: %s).\u0027, reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":248,"context_line":"            else:"},{"line_number":249,"context_line":"                new_hostid \u003d new_hostids.pop()"},{"line_number":250,"context_line":"                db_api.host_allocation_create("},{"line_number":251,"context_line":"                    {\u0027compute_host_id\u0027: new_hostid,"},{"line_number":252,"context_line":"                     \u0027reservation_id\u0027: reservation[\u0027id\u0027]})"},{"line_number":253,"context_line":"                if reservation[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":254,"context_line":"                    # Add the alternative host into the aggregate."},{"line_number":255,"context_line":"                    host_reservation \u003d db_api.host_reservation_get("}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_f915294a","line":252,"range":{"start_line":250,"start_character":0,"end_line":252,"end_character":58},"in_reply_to":"df87a7cf_e58a6e19","updated":"2017-12-19 04:14:57.000000000","message":"Agree!","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"e4277d248b32716ce3d75528961b0f426b808d68","unresolved":false,"context_lines":[{"line_number":426,"context_line":"                    host\u003dhost_id,"},{"line_number":427,"context_line":"                    msg\u003de.message)"},{"line_number":428,"context_line":""},{"line_number":429,"context_line":"    @staticmethod"},{"line_number":430,"context_line":"    def _matching_hosts(hypervisor_properties, resource_properties,"},{"line_number":431,"context_line":"                        count_range, start_date, end_date):"},{"line_number":432,"context_line":"        \"\"\"Return the matching hosts (preferably not allocated)"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_fa7bed88","line":429,"range":{"start_line":429,"start_character":0,"end_line":429,"end_character":17},"updated":"2017-12-18 10:12:37.000000000","message":"Why the class is still staticmethod?","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"9ba8f6412f0f92415af575100e2aceec9a8ffdf6","unresolved":false,"context_lines":[{"line_number":426,"context_line":"                    host\u003dhost_id,"},{"line_number":427,"context_line":"                    msg\u003de.message)"},{"line_number":428,"context_line":""},{"line_number":429,"context_line":"    @staticmethod"},{"line_number":430,"context_line":"    def _matching_hosts(hypervisor_properties, resource_properties,"},{"line_number":431,"context_line":"                        count_range, start_date, end_date):"},{"line_number":432,"context_line":"        \"\"\"Return the matching hosts (preferably not allocated)"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_59045518","line":429,"range":{"start_line":429,"start_character":0,"end_line":429,"end_character":17},"in_reply_to":"df87a7cf_fa7bed88","updated":"2017-12-19 04:14:57.000000000","message":"Done","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"e4277d248b32716ce3d75528961b0f426b808d68","unresolved":false,"context_lines":[{"line_number":601,"context_line":"    # Singleton design pattern"},{"line_number":602,"context_line":"    _instance \u003d None"},{"line_number":603,"context_line":""},{"line_number":604,"context_line":"    def __new__(cls):"},{"line_number":605,"context_line":"        if not cls._instance:"},{"line_number":606,"context_line":"            cls._instance \u003d super(PhysicalHostMonitorPlugin, cls).__new__(cls)"},{"line_number":607,"context_line":"        return cls._instance"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_da9b89c6","line":604,"updated":"2017-12-18 10:12:37.000000000","message":"Nice approach!","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"e4277d248b32716ce3d75528961b0f426b808d68","unresolved":false,"context_lines":[{"line_number":686,"context_line":"                    hv \u003d self.nova.hypervisors.get(host[\u0027id\u0027])"},{"line_number":687,"context_line":"                    LOG.debug(\u0027%s: state\u003d%s, status\u003d%s.\u0027,"},{"line_number":688,"context_line":"                              hv.hypervisor_hostname, hv.state, hv.status)"},{"line_number":689,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"},{"line_number":690,"context_line":"                        failed_hosts.append(host)"},{"line_number":691,"context_line":"                except Exception as e:"},{"line_number":692,"context_line":"                    LOG.exception(\u0027Skipping health check of host %s. %s\u0027,"},{"line_number":693,"context_line":"                                  host[\u0027hypervisor_hostname\u0027], e.message)"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_850b6228","line":690,"range":{"start_line":689,"start_character":0,"end_line":690,"end_character":49},"updated":"2017-12-18 10:12:37.000000000","message":"It detects a hypervisor for a maintenance as well as for a unexpected failure as failed_hosts.  And ALL allocations on the host are re-calculated even though a reservation one of the allocations belongs to starts in 1 year later.\n\nMy suggestion is either of following two idea:\n\n1. Maintenance reservation: To distinguish maintenance with unexpected failure, we use maintenance reservation. The combination of state and status takes four patterns, (up, enable), (down, enable), (up, disable) or (down, disable). Current if-statement matches three latters. For maintenance, if there is a reservation on the host, it only reacts for second one because third one and fourth one happen during maintenance.\n\n2. Time base re-calculation: This monitor-plugin has heal-interval config value that represents a time window for detecting affected reservations because of a failure.  For example, if the value is set to 10 days, the monitor plugin re-calculates reservations which start in 10 days on the failed host.\n\nhow do you think?","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"b5313f9faa64e56c49369ea1162f990906a9de8c","unresolved":false,"context_lines":[{"line_number":686,"context_line":"                    hv \u003d self.nova.hypervisors.get(host[\u0027id\u0027])"},{"line_number":687,"context_line":"                    LOG.debug(\u0027%s: state\u003d%s, status\u003d%s.\u0027,"},{"line_number":688,"context_line":"                              hv.hypervisor_hostname, hv.state, hv.status)"},{"line_number":689,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"},{"line_number":690,"context_line":"                        failed_hosts.append(host)"},{"line_number":691,"context_line":"                except Exception as e:"},{"line_number":692,"context_line":"                    LOG.exception(\u0027Skipping health check of host %s. %s\u0027,"},{"line_number":693,"context_line":"                                  host[\u0027hypervisor_hostname\u0027], e.message)"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_447449cf","line":690,"range":{"start_line":689,"start_character":0,"end_line":690,"end_character":49},"in_reply_to":"df87a7cf_74ea80d8","updated":"2017-12-20 06:53:13.000000000","message":"Based on discussion at the weekly meeting [1], the blazar team agreed to add the following 2 timeframes:\n\n1. Fault confirmation time: the minimum time, e.g. 1 min, required to confirm that a host is down. At the time the fault confirmation time has passed since the fault detection, blazar triggers the reservation-healing (reallocation). It means that blazar does not reallocate if the down time is shorter than the fault confirmation time.\n\n2. Reallocation timeframe: blazar heals (reallocates resources for) only reservations which overlaps the reallocation timeframe from the fault detected time. Then, each reservation checks the reallocation timeframe ahead of the start time whether the reserved resource is still down or not. And if it\u0027s down, try to reallocate other resources.\n\nImplementation of these 2 topics may need a lot of discussion. So, I want to separate these topics from this patch. Let\u0027s proceed reviews of this patch itself and I\u0027ll push another patch for starting discussion of these topics.\n\n[1] http://eavesdrop.openstack.org/meetings/blazar/2017/blazar.2017-12-19-09.00.log.html","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"9ba8f6412f0f92415af575100e2aceec9a8ffdf6","unresolved":false,"context_lines":[{"line_number":686,"context_line":"                    hv \u003d self.nova.hypervisors.get(host[\u0027id\u0027])"},{"line_number":687,"context_line":"                    LOG.debug(\u0027%s: state\u003d%s, status\u003d%s.\u0027,"},{"line_number":688,"context_line":"                              hv.hypervisor_hostname, hv.state, hv.status)"},{"line_number":689,"context_line":"                    if hv.state \u003d\u003d \u0027down\u0027 or hv.status \u003d\u003d \u0027disabled\u0027:"},{"line_number":690,"context_line":"                        failed_hosts.append(host)"},{"line_number":691,"context_line":"                except Exception as e:"},{"line_number":692,"context_line":"                    LOG.exception(\u0027Skipping health check of host %s. %s\u0027,"},{"line_number":693,"context_line":"                                  host[\u0027hypervisor_hostname\u0027], e.message)"}],"source_content_type":"text/x-python","patch_set":10,"id":"df87a7cf_74ea80d8","line":690,"range":{"start_line":689,"start_character":0,"end_line":690,"end_character":49},"in_reply_to":"df87a7cf_850b6228","updated":"2017-12-19 04:14:57.000000000","message":"Thanks for noticing that problem.\nSolution 1 (maintenance reservation) sounds good, however, it may need some big changes including API changes.\nOn the other hands, Solution 2 (time base recalculation) is easy to implement. However, what if the maintenance/failure host is not recovered in the heal-interval?\n\nLet\u0027s discuss it.","commit_id":"dbf4d13fc10c6c8f8d58ad8a986bd1cdaa845139"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"340e12e951d45fb4316c3a8a8458018ca1abc14c","unresolved":false,"context_lines":[{"line_number":238,"context_line":"                \u00271-1\u0027, start_date, lease[\u0027end_date\u0027]"},{"line_number":239,"context_line":"            )"},{"line_number":240,"context_line":"            if not new_hostids:"},{"line_number":241,"context_line":"                reservation_flags.update("},{"line_number":242,"context_line":"                    {reservation[\u0027id\u0027]: {\u0027missing_resources\u0027: True}})"},{"line_number":243,"context_line":"                db_api.host_allocation_destroy(alloc[\u0027id\u0027])"},{"line_number":244,"context_line":"                LOG.warn(\u0027Could not find alternative host for reservation %s \u0027"},{"line_number":245,"context_line":"                         \u0027(lease: %s).\u0027, reservation[\u0027id\u0027], lease[\u0027name\u0027])"}],"source_content_type":"text/x-python","patch_set":13,"id":"7f96bb07_a3da1848","line":242,"range":{"start_line":241,"start_character":0,"end_line":242,"end_character":69},"updated":"2018-01-16 07:03:26.000000000","message":"If reservation_flags already has reservation[\u0027id\u0027] and its value is {\u0027resources_changed\u0027: True}, this overwrites the previous value.","commit_id":"4cf52426c120168e0d626a2beec282bf4a322f20"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2ee63068094861347f5f07f8515115fb887b8086","unresolved":false,"context_lines":[{"line_number":238,"context_line":"                \u00271-1\u0027, start_date, lease[\u0027end_date\u0027]"},{"line_number":239,"context_line":"            )"},{"line_number":240,"context_line":"            if not new_hostids:"},{"line_number":241,"context_line":"                reservation_flags.update("},{"line_number":242,"context_line":"                    {reservation[\u0027id\u0027]: {\u0027missing_resources\u0027: True}})"},{"line_number":243,"context_line":"                db_api.host_allocation_destroy(alloc[\u0027id\u0027])"},{"line_number":244,"context_line":"                LOG.warn(\u0027Could not find alternative host for reservation %s \u0027"},{"line_number":245,"context_line":"                         \u0027(lease: %s).\u0027, reservation[\u0027id\u0027], lease[\u0027name\u0027])"}],"source_content_type":"text/x-python","patch_set":13,"id":"7f96bb07_ad4c22c8","line":242,"range":{"start_line":241,"start_character":0,"end_line":242,"end_character":69},"in_reply_to":"7f96bb07_a3da1848","updated":"2018-01-17 04:37:08.000000000","message":"Done","commit_id":"4cf52426c120168e0d626a2beec282bf4a322f20"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"340e12e951d45fb4316c3a8a8458018ca1abc14c","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                        pool \u003d nova.ReservationPool()"},{"line_number":257,"context_line":"                        pool.add_computehost(host_reservation[\u0027aggregate_id\u0027],"},{"line_number":258,"context_line":"                                             new_host[\u0027service_name\u0027])"},{"line_number":259,"context_line":"                    reservation_flags.update("},{"line_number":260,"context_line":"                        {reservation[\u0027id\u0027]: {\u0027resources_changed\u0027: True}})"},{"line_number":261,"context_line":"                LOG.warn(\u0027Resource changed for reservation %s (lease: %s).\u0027,"},{"line_number":262,"context_line":"                         reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":263,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"7f96bb07_83e59c0b","line":260,"range":{"start_line":259,"start_character":0,"end_line":260,"end_character":73},"updated":"2018-01-16 07:03:26.000000000","message":"same as above.","commit_id":"4cf52426c120168e0d626a2beec282bf4a322f20"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"2ee63068094861347f5f07f8515115fb887b8086","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                        pool \u003d nova.ReservationPool()"},{"line_number":257,"context_line":"                        pool.add_computehost(host_reservation[\u0027aggregate_id\u0027],"},{"line_number":258,"context_line":"                                             new_host[\u0027service_name\u0027])"},{"line_number":259,"context_line":"                    reservation_flags.update("},{"line_number":260,"context_line":"                        {reservation[\u0027id\u0027]: {\u0027resources_changed\u0027: True}})"},{"line_number":261,"context_line":"                LOG.warn(\u0027Resource changed for reservation %s (lease: %s).\u0027,"},{"line_number":262,"context_line":"                         reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":263,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"7f96bb07_cd496eb7","line":260,"range":{"start_line":259,"start_character":0,"end_line":260,"end_character":73},"in_reply_to":"7f96bb07_83e59c0b","updated":"2018-01-17 04:37:08.000000000","message":"Done","commit_id":"4cf52426c120168e0d626a2beec282bf4a322f20"},{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"bcad2e285eedd062e38bf295e643f85eb7a574b5","unresolved":false,"context_lines":[{"line_number":234,"context_line":"            host \u003d db_api.host_get(alloc[\u0027compute_host_id\u0027])"},{"line_number":235,"context_line":"            host_reservation \u003d db_api.host_reservation_get("},{"line_number":236,"context_line":"                reservation[\u0027resource_id\u0027])"},{"line_number":237,"context_line":"            with trusts.create_ctx_from_trust(lease[\u0027trust_id\u0027]):"},{"line_number":238,"context_line":"                pool \u003d nova.ReservationPool()"},{"line_number":239,"context_line":"                pool.remove_computehost(host_reservation[\u0027aggregate_id\u0027],"},{"line_number":240,"context_line":"                                        host[\u0027service_name\u0027])"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"            # Allocate alternative resource."},{"line_number":243,"context_line":"            start_date \u003d max(datetime.datetime.utcnow(), lease[\u0027start_date\u0027])"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f93b717_08478b7a","line":240,"range":{"start_line":237,"start_character":0,"end_line":240,"end_character":61},"updated":"2018-01-29 02:14:03.000000000","message":"This should only work for active reservation.  Reservation pool of \u0027pending\u0027 reservation doesn\u0027t include hots.","commit_id":"e23fe495cb95446e1597c70a76809adde644eb66"},{"author":{"_account_id":23840,"name":"Hiroaki Kobayashi","email":"kobayashi.hiroaki@lab.ntt.co.jp","username":"hiro-kobayashi"},"change_message_id":"c7c2d82aff74d2d699ed3bb7b9ceda29e0e9eb5b","unresolved":false,"context_lines":[{"line_number":234,"context_line":"            host \u003d db_api.host_get(alloc[\u0027compute_host_id\u0027])"},{"line_number":235,"context_line":"            host_reservation \u003d db_api.host_reservation_get("},{"line_number":236,"context_line":"                reservation[\u0027resource_id\u0027])"},{"line_number":237,"context_line":"            with trusts.create_ctx_from_trust(lease[\u0027trust_id\u0027]):"},{"line_number":238,"context_line":"                pool \u003d nova.ReservationPool()"},{"line_number":239,"context_line":"                pool.remove_computehost(host_reservation[\u0027aggregate_id\u0027],"},{"line_number":240,"context_line":"                                        host[\u0027service_name\u0027])"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"            # Allocate alternative resource."},{"line_number":243,"context_line":"            start_date \u003d max(datetime.datetime.utcnow(), lease[\u0027start_date\u0027])"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f93b717_a298f3bf","line":240,"range":{"start_line":237,"start_character":0,"end_line":240,"end_character":61},"in_reply_to":"5f93b717_08478b7a","updated":"2018-01-29 05:01:27.000000000","message":"Oh, sorry. I\u0027ve fixed it.","commit_id":"e23fe495cb95446e1597c70a76809adde644eb66"}]}
