)]}'
{"ironic/drivers/modules/irmc/power.py":[{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"908cc7d6ea52291a4c748bb66d877baefefdc03b","unresolved":false,"context_lines":[{"line_number":231,"context_line":""},{"line_number":232,"context_line":"        :param task: a TaskManager instance containing the node to act on."},{"line_number":233,"context_line":"        :param power_state: Any power state from :mod:`ironic.common.states`."},{"line_number":234,"context_line":"        :param timeout: timeout positive integer (\u003e 0) for any power state."},{"line_number":235,"context_line":"          ``None`` indicates to use default timeout."},{"line_number":236,"context_line":"        :raises: InvalidParameterValue if an invalid power state was specified."},{"line_number":237,"context_line":"        :raises: MissingParameterValue if some mandatory information"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba5da102_a5dad776","line":234,"range":{"start_line":234,"start_character":24,"end_line":234,"end_character":48},"updated":"2016-10-27 07:39:03.000000000","message":"I\u0027ll add the unit.\n\nDitto to other places which doesn\u0027t have the unit.","commit_id":"ed8aa07a9836463fe817e7ae5fe36ebb718180fe"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"50cb937eb6ffd36621e90cb806a367a0d52b8b20","unresolved":false,"context_lines":[{"line_number":77,"context_line":"    :returns: True if expected power state, otherwise Flase."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    if (target_state \u003d\u003d states.SOFT_POWER_OFF and"},{"line_number":80,"context_line":"        boot_status_value in (BOOT_STATUS_VALUE[\u0027unknown\u0027],"},{"line_number":81,"context_line":"                              BOOT_STATUS_VALUE[\u0027off\u0027])):"},{"line_number":82,"context_line":"        return True"},{"line_number":83,"context_line":"    elif (target_state \u003d\u003d states.SOFT_REBOOT and"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_cf6276d8","line":80,"range":{"start_line":80,"start_character":48,"end_line":80,"end_character":57},"updated":"2017-01-13 16:04:10.000000000","message":"Is it always true that unknown means off?","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"21e4586cd6f581f0f5039114a4aad60e547c8470","unresolved":false,"context_lines":[{"line_number":77,"context_line":"    :returns: True if expected power state, otherwise Flase."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    if (target_state \u003d\u003d states.SOFT_POWER_OFF and"},{"line_number":80,"context_line":"        boot_status_value in (BOOT_STATUS_VALUE[\u0027unknown\u0027],"},{"line_number":81,"context_line":"                              BOOT_STATUS_VALUE[\u0027off\u0027])):"},{"line_number":82,"context_line":"        return True"},{"line_number":83,"context_line":"    elif (target_state \u003d\u003d states.SOFT_REBOOT and"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_09d28f00","line":80,"range":{"start_line":80,"start_character":48,"end_line":80,"end_character":57},"in_reply_to":"7a3c09a3_cf6276d8","updated":"2017-01-16 05:10:20.000000000","message":"Yes, SNMP agent in iRMC returns \u0027unknown\u0027 after OS is completely shut down.","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"50cb937eb6ffd36621e90cb806a367a0d52b8b20","unresolved":false,"context_lines":[{"line_number":96,"context_line":"    \"\"\""},{"line_number":97,"context_line":"    node \u003d task.node"},{"line_number":98,"context_line":"    d_info \u003d irmc_common.parse_driver_info(node)"},{"line_number":99,"context_line":"    snmp_client \u003d snmp.SNMPClient(d_info[\u0027irmc_address\u0027],"},{"line_number":100,"context_line":"                                  d_info[\u0027irmc_snmp_port\u0027],"},{"line_number":101,"context_line":"                                  d_info[\u0027irmc_snmp_version\u0027],"},{"line_number":102,"context_line":"                                  d_info[\u0027irmc_snmp_community\u0027],"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_efa7324d","line":99,"updated":"2017-01-13 16:04:10.000000000","message":"Hm, so this adds an implicit dependency on pysnmp. This needs at least to be mentioned in reno, maybe even added to driver-requirements.","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"21e4586cd6f581f0f5039114a4aad60e547c8470","unresolved":false,"context_lines":[{"line_number":96,"context_line":"    \"\"\""},{"line_number":97,"context_line":"    node \u003d task.node"},{"line_number":98,"context_line":"    d_info \u003d irmc_common.parse_driver_info(node)"},{"line_number":99,"context_line":"    snmp_client \u003d snmp.SNMPClient(d_info[\u0027irmc_address\u0027],"},{"line_number":100,"context_line":"                                  d_info[\u0027irmc_snmp_port\u0027],"},{"line_number":101,"context_line":"                                  d_info[\u0027irmc_snmp_version\u0027],"},{"line_number":102,"context_line":"                                  d_info[\u0027irmc_snmp_community\u0027],"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_c935e746","line":99,"in_reply_to":"7a3c09a3_efa7324d","updated":"2017-01-16 05:10:20.000000000","message":"pysnmp has already been listed in the driver-requirements.\nI\u0027ll add pysnmp to the irmc driver reference doc by another patch.","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"50cb937eb6ffd36621e90cb806a367a0d52b8b20","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    for i in range(0, max_retry):"},{"line_number":110,"context_line":"        boot_status_value \u003d snmp_client.get(BOOT_STATUS_OID)"},{"line_number":111,"context_line":"        LOG.debug(\"iRMC SNMP agent of %(node_id)s returned \""},{"line_number":112,"context_line":"                  \"boot status value %(bootstatus)s at %(times)s.\","},{"line_number":113,"context_line":"                  {\u0027node_id\u0027: node.uuid,"},{"line_number":114,"context_line":"                   \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value],"},{"line_number":115,"context_line":"                   \u0027times\u0027: i})"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_cf0356b7","line":112,"range":{"start_line":112,"start_character":52,"end_line":112,"end_character":54},"updated":"2017-01-13 16:04:10.000000000","message":"on attempt","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"21e4586cd6f581f0f5039114a4aad60e547c8470","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    for i in range(0, max_retry):"},{"line_number":110,"context_line":"        boot_status_value \u003d snmp_client.get(BOOT_STATUS_OID)"},{"line_number":111,"context_line":"        LOG.debug(\"iRMC SNMP agent of %(node_id)s returned \""},{"line_number":112,"context_line":"                  \"boot status value %(bootstatus)s at %(times)s.\","},{"line_number":113,"context_line":"                  {\u0027node_id\u0027: node.uuid,"},{"line_number":114,"context_line":"                   \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value],"},{"line_number":115,"context_line":"                   \u0027times\u0027: i})"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_89791fff","line":112,"range":{"start_line":112,"start_character":52,"end_line":112,"end_character":54},"in_reply_to":"7a3c09a3_cf0356b7","updated":"2017-01-16 05:10:20.000000000","message":"I\u0027ll fix that.","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"50cb937eb6ffd36621e90cb806a367a0d52b8b20","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                  \"boot status value %(bootstatus)s at %(times)s.\","},{"line_number":113,"context_line":"                  {\u0027node_id\u0027: node.uuid,"},{"line_number":114,"context_line":"                   \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value],"},{"line_number":115,"context_line":"                   \u0027times\u0027: i})"},{"line_number":116,"context_line":"        if _is_expected_power_state(target_state, boot_status_value):"},{"line_number":117,"context_line":"            # iRMC acknowledged the target state"},{"line_number":118,"context_line":"            node.last_error \u003d None"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_4f268669","line":115,"range":{"start_line":115,"start_character":28,"end_line":115,"end_character":29},"updated":"2017-01-13 16:04:10.000000000","message":"this will output 0, might make sense to do i+1 here.","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"21e4586cd6f581f0f5039114a4aad60e547c8470","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                  \"boot status value %(bootstatus)s at %(times)s.\","},{"line_number":113,"context_line":"                  {\u0027node_id\u0027: node.uuid,"},{"line_number":114,"context_line":"                   \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value],"},{"line_number":115,"context_line":"                   \u0027times\u0027: i})"},{"line_number":116,"context_line":"        if _is_expected_power_state(target_state, boot_status_value):"},{"line_number":117,"context_line":"            # iRMC acknowledged the target state"},{"line_number":118,"context_line":"            node.last_error \u003d None"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a3c09a3_c98327cb","line":115,"range":{"start_line":115,"start_character":28,"end_line":115,"end_character":29},"in_reply_to":"7a3c09a3_4f268669","updated":"2017-01-16 05:10:20.000000000","message":"I\u0027ll fix that.","commit_id":"f44a643a3308f9b5d3cdece777f764e4686cffa1"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"7e27c511ea9669d4161f256324a4531236a2f8d4","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    elif (target_state \u003d\u003d states.SOFT_REBOOT and"},{"line_number":84,"context_line":"          boot_status_value \u003d\u003d BOOT_STATUS_VALUE[\u0027os-running\u0027]):"},{"line_number":85,"context_line":"        return True"},{"line_number":86,"context_line":"    else:"},{"line_number":87,"context_line":"        return False"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"7a3c09a3_f38eb8ce","line":86,"range":{"start_line":86,"start_character":3,"end_line":86,"end_character":9},"updated":"2017-01-17 16:19:46.000000000","message":"nit: else not needed","commit_id":"d57d0b14ed0b280bad1918961b117ae5457e4303"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"7e27c511ea9669d4161f256324a4531236a2f8d4","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    retry_timeout_soft \u003d timeout or CONF.conductor.soft_power_off_timeout"},{"line_number":107,"context_line":"    max_retry \u003d int(retry_timeout_soft / interval)"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    for i in range(0, max_retry):"},{"line_number":110,"context_line":"        boot_status_value \u003d snmp_client.get(BOOT_STATUS_OID)"},{"line_number":111,"context_line":"        LOG.debug(\"iRMC SNMP agent of %(node_id)s returned \""},{"line_number":112,"context_line":"                  \"boot status value %(bootstatus)s on attempt %(times)s.\","},{"line_number":113,"context_line":"                  {\u0027node_id\u0027: node.uuid,"},{"line_number":114,"context_line":"                   \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value],"},{"line_number":115,"context_line":"                   \u0027times\u0027: i + 1})"},{"line_number":116,"context_line":"        if _is_expected_power_state(target_state, boot_status_value):"},{"line_number":117,"context_line":"            # iRMC acknowledged the target state"},{"line_number":118,"context_line":"            node.last_error \u003d None"},{"line_number":119,"context_line":"            node.power_state \u003d target_state"},{"line_number":120,"context_line":"            node.target_power_state \u003d states.NOSTATE"},{"line_number":121,"context_line":"            node.save()"},{"line_number":122,"context_line":"            LOG.info(_LI(\u0027iRMC successfully set node %(node_id)s \u0027"},{"line_number":123,"context_line":"                         \u0027power state to %(bootstatus)s.\u0027),"},{"line_number":124,"context_line":"                     {\u0027node_id\u0027: node.uuid,"},{"line_number":125,"context_line":"                      \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value]})"},{"line_number":126,"context_line":"            return"},{"line_number":127,"context_line":"        else:"},{"line_number":128,"context_line":"            time.sleep(interval)"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"    # iRMC failed to acknowledge the target state"},{"line_number":131,"context_line":"    node.last_error \u003d _("}],"source_content_type":"text/x-python","patch_set":24,"id":"7a3c09a3_d601aab0","line":128,"range":{"start_line":109,"start_character":0,"end_line":128,"end_character":32},"updated":"2017-01-17 16:19:46.000000000","message":"It\u0027s a common practice in Ironic to use the loopingcall.FixedIntervalLoopingCall() class for such wait\u0027ing events in Ironic. Please take a look at:\n\n* https://github.com/openstack/ironic/blob/master/ironic/drivers/modules/cimc/power.py#L52-L75\n\n* https://github.com/openstack/ironic/blob/master/ironic/drivers/modules/seamicro.py#L199-L218\n\n* https://github.com/openstack/ironic/blob/master/ironic/drivers/modules/ucs/power.py#L54-L67","commit_id":"d57d0b14ed0b280bad1918961b117ae5457e4303"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"7e27c511ea9669d4161f256324a4531236a2f8d4","unresolved":false,"context_lines":[{"line_number":130,"context_line":"    # iRMC failed to acknowledge the target state"},{"line_number":131,"context_line":"    node.last_error \u003d _("},{"line_number":132,"context_line":"        \"iRMC failed to acknowledge the target state \""},{"line_number":133,"context_line":"        \"for node %(node_id)s.\""},{"line_number":134,"context_line":"        \"Error: iRMC reteruend unexpected boot status value \""},{"line_number":135,"context_line":"        \"%(bootstatus)s.\") % {"},{"line_number":136,"context_line":"            \u0027node_id\u0027: node.uuid,"}],"source_content_type":"text/x-python","patch_set":24,"id":"7a3c09a3_53814cc2","line":133,"range":{"start_line":133,"start_character":8,"end_line":133,"end_character":31},"updated":"2017-01-17 16:19:46.000000000","message":"We don\u0027t need to include the node UUID here because last_error is already a node specific message","commit_id":"d57d0b14ed0b280bad1918961b117ae5457e4303"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"7e27c511ea9669d4161f256324a4531236a2f8d4","unresolved":false,"context_lines":[{"line_number":131,"context_line":"    node.last_error \u003d _("},{"line_number":132,"context_line":"        \"iRMC failed to acknowledge the target state \""},{"line_number":133,"context_line":"        \"for node %(node_id)s.\""},{"line_number":134,"context_line":"        \"Error: iRMC reteruend unexpected boot status value \""},{"line_number":135,"context_line":"        \"%(bootstatus)s.\") % {"},{"line_number":136,"context_line":"            \u0027node_id\u0027: node.uuid,"},{"line_number":137,"context_line":"            \u0027bootstatus\u0027: BOOT_STATUS[boot_status_value]}"}],"source_content_type":"text/x-python","patch_set":24,"id":"7a3c09a3_735d6878","line":134,"range":{"start_line":134,"start_character":21,"end_line":134,"end_character":30},"updated":"2017-01-17 16:19:46.000000000","message":"returned","commit_id":"d57d0b14ed0b280bad1918961b117ae5457e4303"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"926b58745c408001aac6978b2fa8a89fd83be39d","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"def _is_expected_power_state(target_state, boot_status_value):"},{"line_number":72,"context_line":"    \"\"\"Predicate if target power state and boot status value are matched."},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    :param target_state: Target power state."},{"line_number":75,"context_line":"    :param boot_status_value: SNMP BOOT_STATUS_VALUE."}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_8587b1b3","line":72,"range":{"start_line":72,"start_character":55,"end_line":72,"end_character":72},"updated":"2017-01-24 11:39:28.000000000","message":"nit:\n\n\"... values match\"","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"ae246a10724f1535b2422f8aed6402be78183d72","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"def _is_expected_power_state(target_state, boot_status_value):"},{"line_number":72,"context_line":"    \"\"\"Predicate if target power state and boot status value are matched."},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    :param target_state: Target power state."},{"line_number":75,"context_line":"    :param boot_status_value: SNMP BOOT_STATUS_VALUE."}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_64945e44","line":72,"range":{"start_line":72,"start_character":55,"end_line":72,"end_character":72},"in_reply_to":"5a3905b3_8587b1b3","updated":"2017-01-25 09:42:31.000000000","message":"I\u0027ll fix that.","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"926b58745c408001aac6978b2fa8a89fd83be39d","unresolved":false,"context_lines":[{"line_number":94,"context_line":"         or SNMP failure."},{"line_number":95,"context_line":"    \"\"\""},{"line_number":96,"context_line":"    node \u003d task.node"},{"line_number":97,"context_line":"    d_info \u003d irmc_common.parse_driver_info(node)"},{"line_number":98,"context_line":"    snmp_client \u003d snmp.SNMPClient(d_info[\u0027irmc_address\u0027],"},{"line_number":99,"context_line":"                                  d_info[\u0027irmc_snmp_port\u0027],"},{"line_number":100,"context_line":"                                  d_info[\u0027irmc_snmp_version\u0027],"},{"line_number":101,"context_line":"                                  d_info[\u0027irmc_snmp_community\u0027],"},{"line_number":102,"context_line":"                                  d_info[\u0027irmc_snmp_security\u0027])"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    interval \u003d CONF.irmc.snmp_polling_interval"},{"line_number":105,"context_line":"    retry_timeout_soft \u003d timeout or CONF.conductor.soft_power_off_timeout"}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_a52e6da2","line":102,"range":{"start_line":97,"start_character":0,"end_line":102,"end_character":63},"updated":"2017-01-24 11:39:28.000000000","message":"(mostly nit)\n\nI see we do the same thing in irmc/inspect.py [0]. Perhaps having a common function to instantiate the SNMP client would be better and avoid duplication (irmc already contains a common.py module).\n\n[0] https://github.com/openstack/ironic/blob/master/ironic/drivers/modules/irmc/inspect.py#L97-L101","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"ae246a10724f1535b2422f8aed6402be78183d72","unresolved":false,"context_lines":[{"line_number":94,"context_line":"         or SNMP failure."},{"line_number":95,"context_line":"    \"\"\""},{"line_number":96,"context_line":"    node \u003d task.node"},{"line_number":97,"context_line":"    d_info \u003d irmc_common.parse_driver_info(node)"},{"line_number":98,"context_line":"    snmp_client \u003d snmp.SNMPClient(d_info[\u0027irmc_address\u0027],"},{"line_number":99,"context_line":"                                  d_info[\u0027irmc_snmp_port\u0027],"},{"line_number":100,"context_line":"                                  d_info[\u0027irmc_snmp_version\u0027],"},{"line_number":101,"context_line":"                                  d_info[\u0027irmc_snmp_community\u0027],"},{"line_number":102,"context_line":"                                  d_info[\u0027irmc_snmp_security\u0027])"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    interval \u003d CONF.irmc.snmp_polling_interval"},{"line_number":105,"context_line":"    retry_timeout_soft \u003d timeout or CONF.conductor.soft_power_off_timeout"}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_a50d5239","line":102,"range":{"start_line":97,"start_character":0,"end_line":102,"end_character":63},"in_reply_to":"5a3905b3_a52e6da2","updated":"2017-01-25 09:42:31.000000000","message":"Thanks for the advice. We, Fujitsu, are planning to refactor snmp code into python-scciclient. So we will issue another patch.","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"926b58745c408001aac6978b2fa8a89fd83be39d","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        if mutable[\u0027times\u0027] \u003e max_retry:"},{"line_number":118,"context_line":"            mutable[\u0027state\u0027] \u003d states.ERROR"},{"line_number":119,"context_line":"            raise loopingcall.LoopingCallDone()"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        if _is_expected_power_state(target_state,"},{"line_number":122,"context_line":"                                    mutable[\u0027boot_status_value\u0027]):"}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_18408806","line":119,"updated":"2017-01-24 11:39:28.000000000","message":"it looks a bit strange to increment counter and check for the maximum number of retries before doing the actual check this loop is suppose to do (in this case check if the power state is the one expected).\n\nThis will make the last loop to issue the command to get the power state (L109) but fail before we even compare it (L119). Which is just a waste of resources.\n\nWhat about:\n\n def _wait(multable):\n     multable[\u0027boot_status_value\u0027] \u003d ...\n     if _is_expected_power_state(...):\n          ...\n\n     multable[\u0027times\u0027] +\u003d 1\n     if multable[\u0027times\u0027] \u003e max_retry:\n         ...","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"ae246a10724f1535b2422f8aed6402be78183d72","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        if mutable[\u0027times\u0027] \u003e max_retry:"},{"line_number":118,"context_line":"            mutable[\u0027state\u0027] \u003d states.ERROR"},{"line_number":119,"context_line":"            raise loopingcall.LoopingCallDone()"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        if _is_expected_power_state(target_state,"},{"line_number":122,"context_line":"                                    mutable[\u0027boot_status_value\u0027]):"}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_4fe69b17","line":119,"in_reply_to":"5a3905b3_18408806","updated":"2017-01-25 09:42:31.000000000","message":"I\u0027ll fix that.","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"926b58745c408001aac6978b2fa8a89fd83be39d","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        node.power_state \u003d states.ERROR"},{"line_number":147,"context_line":"        node.target_power_state \u003d states.NOSTATE"},{"line_number":148,"context_line":"        node.save()"},{"line_number":149,"context_line":"        LOG.error(node.last_error)"},{"line_number":150,"context_line":"        error \u003d _(\u0027unexpected boot status value\u0027)"},{"line_number":151,"context_line":"        raise exception.IRMCOperationError(operation\u003dtarget_state,"},{"line_number":152,"context_line":"                                           error\u003derror)"}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_1825e85a","line":149,"range":{"start_line":149,"start_character":8,"end_line":149,"end_character":34},"updated":"2017-01-24 11:39:28.000000000","message":"It would be good to have the node UUID in the log message (not in the last error tho).\n\nMay I suggest:\n\n last_error \u003d _(\u0027iRMC returned unexpected boot status value %s\u0027) % BOOT_STATUS[\u0027boot_status_value\u0027]\n node.last_error \u003d last_error\n ...\n \n LOG.error(_LE(\u0027iRMC failed to acknowledge the target state for node %(node_id)s. Error: %(last_error)s) % {\u0027node_id\u0027: ..., \u0027last_error\u0027: last_error})","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"ae246a10724f1535b2422f8aed6402be78183d72","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        node.power_state \u003d states.ERROR"},{"line_number":147,"context_line":"        node.target_power_state \u003d states.NOSTATE"},{"line_number":148,"context_line":"        node.save()"},{"line_number":149,"context_line":"        LOG.error(node.last_error)"},{"line_number":150,"context_line":"        error \u003d _(\u0027unexpected boot status value\u0027)"},{"line_number":151,"context_line":"        raise exception.IRMCOperationError(operation\u003dtarget_state,"},{"line_number":152,"context_line":"                                           error\u003derror)"}],"source_content_type":"text/x-python","patch_set":25,"id":"5a3905b3_6a6ee597","line":149,"range":{"start_line":149,"start_character":8,"end_line":149,"end_character":34},"in_reply_to":"5a3905b3_1825e85a","updated":"2017-01-25 09:42:31.000000000","message":"I\u0027ll fix that.","commit_id":"86a39c46a0a652c88aa78bc6aad882a8e5106602"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"c2024f3532ab5f00e88269945c0379d318416f90","unresolved":false,"context_lines":[{"line_number":177,"context_line":"        irmc_client(STATES_MAP[target_state])"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        if target_state in (states.SOFT_REBOOT, states.SOFT_POWER_OFF):"},{"line_number":180,"context_line":"            _wait_power_state(task, target_state, timeout\u003dtimeout)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    except KeyError:"},{"line_number":183,"context_line":"        msg \u003d _(\"_set_power_state called with invalid power state \""}],"source_content_type":"text/x-python","patch_set":26,"id":"3a461143_522f34a1","line":180,"updated":"2017-01-25 13:57:15.000000000","message":"nit: this is not expected to raise KeyError, so it should be moved to a separate try..except block","commit_id":"d2a4dca36d236f29298ef6f00ee36cf0b3d6f976"},{"author":{"_account_id":13719,"name":"Naohiro Tamura","email":"naohirot.openstack@gmail.com","username":"nao"},"change_message_id":"49ca62a66b63da7101cf53264dd29f7fffeea979","unresolved":false,"context_lines":[{"line_number":177,"context_line":"        irmc_client(STATES_MAP[target_state])"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        if target_state in (states.SOFT_REBOOT, states.SOFT_POWER_OFF):"},{"line_number":180,"context_line":"            _wait_power_state(task, target_state, timeout\u003dtimeout)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    except KeyError:"},{"line_number":183,"context_line":"        msg \u003d _(\"_set_power_state called with invalid power state \""}],"source_content_type":"text/x-python","patch_set":26,"id":"3a461143_97d167fe","line":180,"in_reply_to":"3a461143_522f34a1","updated":"2017-01-26 05:59:45.000000000","message":"I\u0027ll fix that.","commit_id":"d2a4dca36d236f29298ef6f00ee36cf0b3d6f976"}]}
