)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"9eac5e5a7aa17d324473fcfbcb6a1ef008da8a77","unresolved":false,"context_lines":[{"line_number":9,"context_line":"  sync_power_state periodic task tries to set node\u0027s actual power state"},{"line_number":10,"context_line":"  if force_sync_power_state flag is True. In case of failure to force"},{"line_number":11,"context_line":"  sync power state, Ironic will keep trying to force sync power state,"},{"line_number":12,"context_line":"  Hence introduce a max retry per node force sync power state limit."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: Idbd3afab746f81b9097e97afb1d12a81686a4564"},{"line_number":15,"context_line":"Closes-Bug: #1285806"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"AAAAVn%2F%2F%2FXY%3D","line":12,"updated":"2014-03-02 22:26:30.000000000","message":"AFAIR there are no requirement to indent detailed description, though I don\u0027t have any args against this.","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"}],"ironic/conductor/manager.py":[{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"9eac5e5a7aa17d324473fcfbcb6a1ef008da8a77","unresolved":false,"context_lines":[{"line_number":112,"context_line":""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"def _do_sync_power_state(task):"},{"line_number":115,"context_line":"    global FORCE_POWER_STATE_SYNC_COUNT"},{"line_number":116,"context_line":"    node \u003d task.node"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2F%2FXA%3D","line":115,"updated":"2014-03-02 22:26:30.000000000","message":"I think it\u0027s better to move this method to manager, and make FORCE_POWER_STATE_SYNC_COUNT a manager\u0027s field.","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"2e83d08f1944428d1b4801a1be8d1db7efa4de75","unresolved":false,"context_lines":[{"line_number":112,"context_line":""},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"def _do_sync_power_state(task):"},{"line_number":115,"context_line":"    global FORCE_POWER_STATE_SYNC_COUNT"},{"line_number":116,"context_line":"    node \u003d task.node"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2F6KQ%3D","line":115,"in_reply_to":"AAAAVn%2F%2F%2FXA%3D","updated":"2014-03-03 13:58:58.000000000","message":"Done","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"9eac5e5a7aa17d324473fcfbcb6a1ef008da8a77","unresolved":false,"context_lines":[{"line_number":141,"context_line":"            LOG.warning(_(\"Max retries exceeded during sync_power_state for \""},{"line_number":142,"context_line":"                          \"node %s, Not changing hardware power state\"),"},{"line_number":143,"context_line":"                        node.uuid)"},{"line_number":144,"context_line":"            return"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":147,"context_line":"                      \"\u0027%(actual)s\u0027 does not match expected state. \""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2F%2FWI%3D","line":144,"updated":"2014-03-02 22:26:30.000000000","message":"So this will be printed to the log each time within the next nodes roundtrip..\n\nI think we need a way to exclude the node from the sync list, moreover - to mark it as not healthy (Maybe to put it to maintenance mode?). \n\nAs an option we can\n     1. Set db power state to actual hardware\n     2. Put some info to last_error\n     3. Put the node into maintenance mode so the user \nwill have to pay attention to this and probably go \nand check what is going on","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"2e83d08f1944428d1b4801a1be8d1db7efa4de75","unresolved":false,"context_lines":[{"line_number":141,"context_line":"            LOG.warning(_(\"Max retries exceeded during sync_power_state for \""},{"line_number":142,"context_line":"                          \"node %s, Not changing hardware power state\"),"},{"line_number":143,"context_line":"                        node.uuid)"},{"line_number":144,"context_line":"            return"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":147,"context_line":"                      \"\u0027%(actual)s\u0027 does not match expected state. \""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2F6KY%3D","line":144,"in_reply_to":"AAAAVn%2F%2F%2FWI%3D","updated":"2014-03-03 13:58:58.000000000","message":"Done","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"9eac5e5a7aa17d324473fcfbcb6a1ef008da8a77","unresolved":false,"context_lines":[{"line_number":161,"context_line":"                                             \u0027state\u0027: node.power_state})"},{"line_number":162,"context_line":"        else:"},{"line_number":163,"context_line":"            # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":164,"context_line":"            FORCE_POWER_STATE_SYNC_COUNT[node.uuid] +\u003d 1"},{"line_number":165,"context_line":"    else:"},{"line_number":166,"context_line":"        LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":167,"context_line":"                      \"does not match expected state \u0027%(state)s\u0027. \""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2F%2FVg%3D","line":164,"updated":"2014-03-02 22:26:30.000000000","message":"\"else\" will be called when there are no exceptions.. node_power action is synchronous so after the call we can surely know whether action was successful or no. Therefore I would expect:\n\ntry:\n            # node_power_action will update the node record\n            # so don\u0027t do that again here.\n            utils.node_power_action(task, task.node,\n                                    node.power_state)\n            FORCE_POWER_STATE_SYNC_COUNT[node.uuid] \u003d 0\n        except Exception as e:\n            # TODO(rloo): change to IronicException after\n            # https://bugs.launchpad.net/ironic/+bug/1267693\n            LOG.error(_(\"Failed to change power state of node %(node)s \"\n                        \"to \u0027%(state)s\u0027.\"), {\u0027node\u0027: node.uuid,\n                                             \u0027state\u0027: node.power_state})\n            FORCE_POWER_STATE_SYNC_COUNT[node.uuid] +\u003d 1\n\nThough in this case there will be a room for infinite syncing - if the driver is broken and set_power_state does not work as expected. In this case current implementation makes sense, but we also will need to add \n\n if power_state \u003d\u003d node.power_state:\n      # Clear counter if the node is fine\n     FORCE_POWER_STATE_SYNC_COUNT[node.uuid] \u003d 0\n     return\n\nOpened question to the team - can we rely on the driver all the time or we want to protect Ironic from infinite syncing even for broken drivers case?","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"2e83d08f1944428d1b4801a1be8d1db7efa4de75","unresolved":false,"context_lines":[{"line_number":161,"context_line":"                                             \u0027state\u0027: node.power_state})"},{"line_number":162,"context_line":"        else:"},{"line_number":163,"context_line":"            # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":164,"context_line":"            FORCE_POWER_STATE_SYNC_COUNT[node.uuid] +\u003d 1"},{"line_number":165,"context_line":"    else:"},{"line_number":166,"context_line":"        LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":167,"context_line":"                      \"does not match expected state \u0027%(state)s\u0027. \""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2F6Rg%3D","line":164,"in_reply_to":"AAAAVn%2F%2F%2FVg%3D","updated":"2014-03-03 13:58:58.000000000","message":"Good inputs, I think this needs to be discussed in irc channel or irc meeting. Till then i will stick to original solution and reset sync count when both power states match","commit_id":"83b1969490deb90b60fe8e36581318aafa929633"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"6977f7789c02957913f59df3b807f213c76cf2a7","unresolved":false,"context_lines":[{"line_number":398,"context_line":"            #             https://bugs.launchpad.net/ironic/+bug/1267693"},{"line_number":399,"context_line":"            LOG.warning(_(\"During sync_power_state, could not get power \""},{"line_number":400,"context_line":"                          \"state for node %(node)s. Error: %(err)s.\"),"},{"line_number":401,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":402,"context_line":"            return"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"        if node.power_state is None:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2F104%3D","line":401,"updated":"2014-03-03 22:00:04.000000000","message":"Maybe to increase counter here as well?","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"ae9de76325778ffcd005f7b456f57d4c8dc473eb","unresolved":false,"context_lines":[{"line_number":398,"context_line":"            #             https://bugs.launchpad.net/ironic/+bug/1267693"},{"line_number":399,"context_line":"            LOG.warning(_(\"During sync_power_state, could not get power \""},{"line_number":400,"context_line":"                          \"state for node %(node)s. Error: %(err)s.\"),"},{"line_number":401,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":402,"context_line":"            return"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"        if node.power_state is None:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FxeA%3D","line":401,"in_reply_to":"AAAAVn%2F%2F104%3D","updated":"2014-03-04 07:05:14.000000000","message":"Done","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"6977f7789c02957913f59df3b807f213c76cf2a7","unresolved":false,"context_lines":[{"line_number":417,"context_line":"            if (self.force_power_state_sync_count[node.uuid] \u003e\u003d"},{"line_number":418,"context_line":"                CONF.conductor.force_power_state_sync_max_retries):"},{"line_number":419,"context_line":"                msg \u003d (_(\"During sync_power_state, max retries exceeded \""},{"line_number":420,"context_line":"                          \"for node %(node)s, node %(node)s state \""},{"line_number":421,"context_line":"                          \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":422,"context_line":"                          \"Updating recorded state to \u0027%(actual)s\u0027 \""},{"line_number":423,"context_line":"                          \"And changing node to maintenance mode.\"),"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2F1WY%3D","line":420,"updated":"2014-03-03 22:00:04.000000000","message":"I guess mentioning node twice is not really needed, maybe better\n\nnode\u0027s state \"state\" does not match expected state \"state\". Updating DB state to actual, and switching node to maintenance mode\n\nwhat do you think?","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"ae9de76325778ffcd005f7b456f57d4c8dc473eb","unresolved":false,"context_lines":[{"line_number":417,"context_line":"            if (self.force_power_state_sync_count[node.uuid] \u003e\u003d"},{"line_number":418,"context_line":"                CONF.conductor.force_power_state_sync_max_retries):"},{"line_number":419,"context_line":"                msg \u003d (_(\"During sync_power_state, max retries exceeded \""},{"line_number":420,"context_line":"                          \"for node %(node)s, node %(node)s state \""},{"line_number":421,"context_line":"                          \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":422,"context_line":"                          \"Updating recorded state to \u0027%(actual)s\u0027 \""},{"line_number":423,"context_line":"                          \"And changing node to maintenance mode.\"),"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2Fxd0%3D","line":420,"in_reply_to":"AAAAVn%2F%2F1WY%3D","updated":"2014-03-04 07:05:14.000000000","message":"Done, Nice input :)","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"6977f7789c02957913f59df3b807f213c76cf2a7","unresolved":false,"context_lines":[{"line_number":445,"context_line":"                # https://bugs.launchpad.net/ironic/+bug/1267693"},{"line_number":446,"context_line":"                LOG.error(_(\"Failed to change power state of node %(node)s \""},{"line_number":447,"context_line":"                            \"to \u0027%(state)s\u0027.\"), {\u0027node\u0027: node.uuid,"},{"line_number":448,"context_line":"                                                 \u0027state\u0027: node.power_state})"},{"line_number":449,"context_line":"            else:"},{"line_number":450,"context_line":"                # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":451,"context_line":"                self.force_power_state_sync_count[node.uuid] +\u003d 1"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2F1Vc%3D","line":448,"updated":"2014-03-03 22:00:04.000000000","message":"Maybe log something like \"N attempts left?\"","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"ae9de76325778ffcd005f7b456f57d4c8dc473eb","unresolved":false,"context_lines":[{"line_number":445,"context_line":"                # https://bugs.launchpad.net/ironic/+bug/1267693"},{"line_number":446,"context_line":"                LOG.error(_(\"Failed to change power state of node %(node)s \""},{"line_number":447,"context_line":"                            \"to \u0027%(state)s\u0027.\"), {\u0027node\u0027: node.uuid,"},{"line_number":448,"context_line":"                                                 \u0027state\u0027: node.power_state})"},{"line_number":449,"context_line":"            else:"},{"line_number":450,"context_line":"                # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":451,"context_line":"                self.force_power_state_sync_count[node.uuid] +\u003d 1"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2Fxdk%3D","line":448,"in_reply_to":"AAAAVn%2F%2F1Vc%3D","updated":"2014-03-04 07:05:14.000000000","message":"Done, Nice input :)","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"6977f7789c02957913f59df3b807f213c76cf2a7","unresolved":false,"context_lines":[{"line_number":448,"context_line":"                                                 \u0027state\u0027: node.power_state})"},{"line_number":449,"context_line":"            else:"},{"line_number":450,"context_line":"                # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":451,"context_line":"                self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":452,"context_line":"        else:"},{"line_number":453,"context_line":"            LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":454,"context_line":"                          \"does not match expected state \u0027%(state)s\u0027. \""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2F1Ts%3D","line":451,"updated":"2014-03-03 22:00:04.000000000","message":"This can be moved to the end of the try. Else is typically used when there is some action that should be executed ONLY if there were NO exception, BUT the action itself CAN throw an exception which should NOT be handled. For this case, to not to use a flag in the end of the try, they came up with Else.\n\nThis is not our case, I think it will look clearer in the end of the try. Makes sense? :)","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"ae9de76325778ffcd005f7b456f57d4c8dc473eb","unresolved":false,"context_lines":[{"line_number":448,"context_line":"                                                 \u0027state\u0027: node.power_state})"},{"line_number":449,"context_line":"            else:"},{"line_number":450,"context_line":"                # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":451,"context_line":"                self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":452,"context_line":"        else:"},{"line_number":453,"context_line":"            LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":454,"context_line":"                          \"does not match expected state \u0027%(state)s\u0027. \""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FxdY%3D","line":451,"in_reply_to":"AAAAVn%2F%2F1Ts%3D","updated":"2014-03-04 07:05:14.000000000","message":"Done, Nice input :)","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"6977f7789c02957913f59df3b807f213c76cf2a7","unresolved":false,"context_lines":[{"line_number":449,"context_line":"            else:"},{"line_number":450,"context_line":"                # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":451,"context_line":"                self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":452,"context_line":"        else:"},{"line_number":453,"context_line":"            LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":454,"context_line":"                          \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":455,"context_line":"                          \"Updating recorded state to \u0027%(actual)s\u0027.\"),"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2F1QI%3D","line":452,"updated":"2014-03-03 22:00:04.000000000","message":"This if/else looks very long... how about switch condition + to move this above, like:\n\nif not CONF.conductor.force_power_state_during_sync:\n   LOG.warning(_(\"During sync_power_state, node %(node)s  state \"\n   ....\n   return\n\nif (self.force_power_state_sync_count[node.uuid] \u003e\u003d\n               CONF.conductor.force_power_state_sync_max_retries):\n   ....\n\nI know it\u0027s not your part of change, so It\u0027s up to you whether to apply this on or not :)","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"ae9de76325778ffcd005f7b456f57d4c8dc473eb","unresolved":false,"context_lines":[{"line_number":449,"context_line":"            else:"},{"line_number":450,"context_line":"                # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":451,"context_line":"                self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":452,"context_line":"        else:"},{"line_number":453,"context_line":"            LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":454,"context_line":"                          \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":455,"context_line":"                          \"Updating recorded state to \u0027%(actual)s\u0027.\"),"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FxeM%3D","line":452,"in_reply_to":"AAAAVn%2F%2F1QI%3D","updated":"2014-03-04 07:05:14.000000000","message":"Done, Nice input :)","commit_id":"3605b9c3a648e538849f07f436bb23fdf6713766"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"f2ec228aa56ab2ab6fefae222c9e476d6473e0c8","unresolved":false,"context_lines":[{"line_number":401,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":402,"context_line":""},{"line_number":403,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":404,"context_line":"            return"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"        if node.power_state is None:"},{"line_number":407,"context_line":"            LOG.info(_(\"During sync_power_state, node %(node)s has no \""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAVn%2F%2FvlY%3D","line":404,"updated":"2014-03-04 10:57:29.000000000","message":"hmm now this can increase the counter infinitely, but never check if it exceeds maximum..","commit_id":"24d78bf8165c94cea3c1075585331f03ce927162"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"a63366d91b771f7a75c4b5d7003e0618712d2d65","unresolved":false,"context_lines":[{"line_number":401,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":402,"context_line":""},{"line_number":403,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":404,"context_line":"            return"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"        if node.power_state is None:"},{"line_number":407,"context_line":"            LOG.info(_(\"During sync_power_state, node %(node)s has no \""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAVn%2F%2Fvms%3D","line":404,"updated":"2014-03-04 10:53:54.000000000","message":"task.driver.power.get_power_state() always raises exception for a node we do nothing (return), force_power_state_sync_count[node.uuid] will not be used.","commit_id":"24d78bf8165c94cea3c1075585331f03ce927162"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"8b4f0ae928b4de2391c2edb402e7287a43f503e7","unresolved":false,"context_lines":[{"line_number":401,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":402,"context_line":""},{"line_number":403,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":404,"context_line":"            return"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"        if node.power_state is None:"},{"line_number":407,"context_line":"            LOG.info(_(\"During sync_power_state, node %(node)s has no \""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAVn%2F%2FvkY%3D","line":404,"in_reply_to":"AAAAVn%2F%2Fvms%3D","updated":"2014-03-04 10:55:35.000000000","message":"Fix:\nIf task.driver.power.get_power_state() always raises exception ...","commit_id":"24d78bf8165c94cea3c1075585331f03ce927162"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"a63366d91b771f7a75c4b5d7003e0618712d2d65","unresolved":false,"context_lines":[{"line_number":454,"context_line":"                                    node.power_state)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"            # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":457,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":458,"context_line":"        except Exception as e:"},{"line_number":459,"context_line":"            # TODO(rloo): change to IronicException after"},{"line_number":460,"context_line":"            # https://bugs.launchpad.net/ironic/+bug/1267693"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAVn%2F%2FvpU%3D","line":457,"updated":"2014-03-04 10:53:54.000000000","message":"If utils.node_power_action() l453 raises exception this code will not work.\nMove to finally block as variant?","commit_id":"24d78bf8165c94cea3c1075585331f03ce927162"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"f2ec228aa56ab2ab6fefae222c9e476d6473e0c8","unresolved":false,"context_lines":[{"line_number":454,"context_line":"                                    node.power_state)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"            # Update FORCE_POWER_STATE_SYNC_COUNT for current node"},{"line_number":457,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":458,"context_line":"        except Exception as e:"},{"line_number":459,"context_line":"            # TODO(rloo): change to IronicException after"},{"line_number":460,"context_line":"            # https://bugs.launchpad.net/ironic/+bug/1267693"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAVn%2F%2FvkE%3D","line":457,"in_reply_to":"AAAAVn%2F%2FvpU%3D","updated":"2014-03-04 10:57:29.000000000","message":"ahh, true, my bad, I suggested to move this here, you\u0027re right, finally is appropriate..","commit_id":"24d78bf8165c94cea3c1075585331f03ce927162"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"4f5b34d370cbc87d2d90fc41596fe6955ffb9620","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                   default\u003d3,"},{"line_number":104,"context_line":"                   help\u003d\u0027During sync_power_state, limit the number of times \u0027"},{"line_number":105,"context_line":"                        \u0027Ironic should try syncing the hardware node power \u0027"},{"line_number":106,"context_line":"                        \u0027state with the node power state in DB\u0027)"},{"line_number":107,"context_line":"]"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"CONF \u003d cfg.CONF"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FXSE%3D","line":106,"updated":"2014-03-06 23:32:16.000000000","message":"Should we mention something about it being applicable only if force_power_state_during_sync\u003dTrue? [I am asking, don\u0027t feel strongly one way or the other.]","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"3ff084838565d84af28e5d11e1dd4d35ce44cf80","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                   default\u003d3,"},{"line_number":104,"context_line":"                   help\u003d\u0027During sync_power_state, limit the number of times \u0027"},{"line_number":105,"context_line":"                        \u0027Ironic should try syncing the hardware node power \u0027"},{"line_number":106,"context_line":"                        \u0027state with the node power state in DB\u0027)"},{"line_number":107,"context_line":"]"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"CONF \u003d cfg.CONF"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FRrk%3D","line":106,"in_reply_to":"AAAAVn%2F%2FXSE%3D","updated":"2014-03-07 04:57:49.000000000","message":"We want this to be applicable even when force_power_state_during_sync\u003dFalse, I have made changes to the next patch, please check.","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"4f5b34d370cbc87d2d90fc41596fe6955ffb9620","unresolved":false,"context_lines":[{"line_number":392,"context_line":"                                                      actual_power_state):"},{"line_number":393,"context_line":"        node \u003d task.node"},{"line_number":394,"context_line":"        msg \u003d (_(\"During sync_power_state, max retries exceeded \""},{"line_number":395,"context_line":"                  \"for node %(node)s, node state %(actual)s\""},{"line_number":396,"context_line":"                  \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":397,"context_line":"                  \"Updating DB state to \u0027%(actual)s\u0027 \""},{"line_number":398,"context_line":"                  \"Switching node to maintenance mode.\"),"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FTXU%3D","line":395,"updated":"2014-03-06 23:32:16.000000000","message":"might be good to have a space at the end of this, so it doesn\u0027t run into the \u0027does\u0027 below.\n\nI will have more comments about this but I want to make sure I understand.","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"3ff084838565d84af28e5d11e1dd4d35ce44cf80","unresolved":false,"context_lines":[{"line_number":392,"context_line":"                                                      actual_power_state):"},{"line_number":393,"context_line":"        node \u003d task.node"},{"line_number":394,"context_line":"        msg \u003d (_(\"During sync_power_state, max retries exceeded \""},{"line_number":395,"context_line":"                  \"for node %(node)s, node state %(actual)s\""},{"line_number":396,"context_line":"                  \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":397,"context_line":"                  \"Updating DB state to \u0027%(actual)s\u0027 \""},{"line_number":398,"context_line":"                  \"Switching node to maintenance mode.\"),"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FRrc%3D","line":395,"in_reply_to":"AAAAVn%2F%2FTXU%3D","updated":"2014-03-07 04:57:49.000000000","message":"Done","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"4f5b34d370cbc87d2d90fc41596fe6955ffb9620","unresolved":false,"context_lines":[{"line_number":416,"context_line":"            LOG.warning(_(\"During sync_power_state, could not get power \""},{"line_number":417,"context_line":"                          \"state for node %(node)s. Error: %(err)s.\"),"},{"line_number":418,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":419,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"            if (self.force_power_state_sync_count[node.uuid] \u003e\u003d"},{"line_number":422,"context_line":"                CONF.conductor.force_power_state_sync_max_retries):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FTXM%3D","line":419,"updated":"2014-03-06 23:32:16.000000000","message":"I want to make sure I understand this. Even if force_power_state_sync\u003dFalse, the sync count will increment and count might exceed max retries. In which case, it would go in maintenance mode and last_error would be set etc. Is this what we want? (Because I thought force_power_state_sync_max_retries was only used if force_power_state_sync\u003dTrue.)","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"3ff084838565d84af28e5d11e1dd4d35ce44cf80","unresolved":false,"context_lines":[{"line_number":416,"context_line":"            LOG.warning(_(\"During sync_power_state, could not get power \""},{"line_number":417,"context_line":"                          \"state for node %(node)s. Error: %(err)s.\"),"},{"line_number":418,"context_line":"                          {\u0027node\u0027: node.uuid, \u0027err\u0027: e})"},{"line_number":419,"context_line":"            self.force_power_state_sync_count[node.uuid] +\u003d 1"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"            if (self.force_power_state_sync_count[node.uuid] \u003e\u003d"},{"line_number":422,"context_line":"                CONF.conductor.force_power_state_sync_max_retries):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FRqY%3D","line":419,"in_reply_to":"AAAAVn%2F%2FTXM%3D","updated":"2014-03-07 04:57:49.000000000","message":"Yes, even if force_power_state_sync\u003dFalse, the sync count will increment and count might exceed max retries. I have made changes to next patch to reflect this. please check","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"4f5b34d370cbc87d2d90fc41596fe6955ffb9620","unresolved":false,"context_lines":[{"line_number":458,"context_line":"                                                               power_state)"},{"line_number":459,"context_line":"            return"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"        # Force set actual power_state of node equal to DB power_state of node"},{"line_number":462,"context_line":"        LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":463,"context_line":"                      \"\u0027%(actual)s\u0027 does not match expected state. \""},{"line_number":464,"context_line":"                      \"Changing hardware state to \u0027%(state)s\u0027.\"),"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FXLk%3D","line":461,"updated":"2014-03-06 23:32:16.000000000","message":"Probably don\u0027t need both \u0027force\u0027 and \u0027set\u0027 :-)","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"3ff084838565d84af28e5d11e1dd4d35ce44cf80","unresolved":false,"context_lines":[{"line_number":458,"context_line":"                                                               power_state)"},{"line_number":459,"context_line":"            return"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"        # Force set actual power_state of node equal to DB power_state of node"},{"line_number":462,"context_line":"        LOG.warning(_(\"During sync_power_state, node %(node)s state \""},{"line_number":463,"context_line":"                      \"\u0027%(actual)s\u0027 does not match expected state. \""},{"line_number":464,"context_line":"                      \"Changing hardware state to \u0027%(state)s\u0027.\"),"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FRrU%3D","line":461,"in_reply_to":"AAAAVn%2F%2FXLk%3D","updated":"2014-03-07 04:57:49.000000000","message":"Done","commit_id":"a62476451dc1d1c8dad44eca72cecccdb60b8222"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"1b25dbea0a5757aeca7fb283cf49ae7c35669208","unresolved":false,"context_lines":[{"line_number":424,"context_line":"                # If the node was already switched to maintenance mode,"},{"line_number":425,"context_line":"                # dont process further"},{"line_number":426,"context_line":"                if node.maintenance:"},{"line_number":427,"context_line":"                    return"},{"line_number":428,"context_line":""},{"line_number":429,"context_line":"                self._handle_sync_power_state_max_retries_exceeded(task,"},{"line_number":430,"context_line":"                                                                   power_state)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAVn%2F%2FO6k%3D","line":427,"updated":"2014-03-07 13:03:58.000000000","message":"This is interesting check.. now I think that we should not try to get node power state if the node is in maintenance. I think should not even pick the lock for this node if it\u0027s in maintenance, maybe to move this check to the _sync_power_states (before with task_manager.acquire )\n\nhmm, this raises a bigger question - whether we should run any periodic tasks if node in maintenance. As far as I see we still running them and picking the lock","commit_id":"ee1c9539b7447fd95a29e6ba2caa2fcd140318fe"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"1b25dbea0a5757aeca7fb283cf49ae7c35669208","unresolved":false,"context_lines":[{"line_number":480,"context_line":"                     \"sync_power_state for node %(node)s\"),"},{"line_number":481,"context_line":"                   {\u0027left\u0027:"},{"line_number":482,"context_line":"                   (CONF.conductor.power_state_sync_max_retries -"},{"line_number":483,"context_line":"                    self.power_state_sync_count[node.uuid]),"},{"line_number":484,"context_line":"                    \u0027node\u0027: node.uuid})"},{"line_number":485,"context_line":"            LOG.warning(msg)"},{"line_number":486,"context_line":"        finally:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAVn%2F%2FOzg%3D","line":483,"updated":"2014-03-07 13:03:58.000000000","message":"just for sake of readability - pls move save this to a separate variable, like attempts_left","commit_id":"ee1c9539b7447fd95a29e6ba2caa2fcd140318fe"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"818e01988ed66d9b2781907a8f1882c59f9fd7f1","unresolved":false,"context_lines":[{"line_number":471,"context_line":"                        \"to \u0027%(state)s\u0027.\"), {\u0027node\u0027: node.uuid,"},{"line_number":472,"context_line":"                                             \u0027state\u0027: node.power_state})"},{"line_number":473,"context_line":"            attempts_left \u003d (CONF.conductor.power_state_sync_max_retries -"},{"line_number":474,"context_line":"                             self.power_state_sync_count[node.uuid])"},{"line_number":475,"context_line":"            msg \u003d (_(\"%(left)s attempts remaining to \""},{"line_number":476,"context_line":"                     \"sync_power_state for node %(node)s\"),"},{"line_number":477,"context_line":"                   {\u0027left\u0027: attempts_left,"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2FsWc%3D","line":474,"updated":"2014-03-14 13:14:03.000000000","message":"Looks like need to add -1 to attempts_left because count incremented after this code.","commit_id":"f186b91fc7cabee45c4d1c1abbfc22e2a38bb5da"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"818e01988ed66d9b2781907a8f1882c59f9fd7f1","unresolved":false,"context_lines":[{"line_number":502,"context_line":""},{"line_number":503,"context_line":"                # If the node was already switched to maintenance mode,"},{"line_number":504,"context_line":"                # dont process further for this node"},{"line_number":505,"context_line":"                if node.maintenance:"},{"line_number":506,"context_line":"                    continue"},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"                with task_manager.acquire(context, node_id) as task:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2Fsbk%3D","line":505,"updated":"2014-03-14 13:14:03.000000000","message":"I think better add \u0027maintenance\u0027: False to filters (l487) instead because race if maintenance will be set manually after dbapi call is not critical.","commit_id":"f186b91fc7cabee45c4d1c1abbfc22e2a38bb5da"},{"author":{"_account_id":1030,"name":"Chris Behrens","email":"cbehrens@codestud.com","username":"cbehrens"},"change_message_id":"65725be8fd6a4f24c4f9932704bac776618a6ba1","unresolved":false,"context_lines":[{"line_number":469,"context_line":"            node.save(task.context)"},{"line_number":470,"context_line":""},{"line_number":471,"context_line":"        if power_state \u003d\u003d node.power_state:"},{"line_number":472,"context_line":"            self.power_state_sync_count[node.uuid] \u003d 0"},{"line_number":473,"context_line":"            return"},{"line_number":474,"context_line":""},{"line_number":475,"context_line":"        if not CONF.conductor.force_power_state_during_sync:"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAWH%2F%2FkDw%3D","line":472,"updated":"2014-03-17 00:33:37.000000000","message":"It seems like this dictionary can just grow forever if one decided to constantly remove and add nodes. I\u0027m not sure what the use case for that would be, so it\u0027s probably not a big deal, but it still bugs me enough to point this out. :)","commit_id":"563ccecca5bbbb9a8aaff7dff5c8c743a52cfe03"},{"author":{"_account_id":1030,"name":"Chris Behrens","email":"cbehrens@codestud.com","username":"cbehrens"},"change_message_id":"06bc55fd531bf6c0c8e95d9b2bbcb4d219d07478","unresolved":false,"context_lines":[{"line_number":470,"context_line":""},{"line_number":471,"context_line":"        if power_state \u003d\u003d node.power_state:"},{"line_number":472,"context_line":"            if node.uuid in self.power_state_sync_count:"},{"line_number":473,"context_line":"                self.power_state_sync_count[node.uuid] \u003d 0"},{"line_number":474,"context_line":"            return"},{"line_number":475,"context_line":""},{"line_number":476,"context_line":"        if not CONF.conductor.force_power_state_during_sync:"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAWH%2F%2B7Lk%3D","line":473,"updated":"2014-03-21 16:43:20.000000000","message":"Sorry, I may not have been extremely clear in the last comment. I was actually thinking that the node is completely removed from the dictionary if it was there...  every time there is a successful return. That would ensure the dictionary doesn\u0027t grow without bound.","commit_id":"b42a84bee7f6936389e05ee03ffd87744014ae2f"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"c9f219b2193043deac90908437fc145f8ed44b45","unresolved":false,"context_lines":[{"line_number":470,"context_line":""},{"line_number":471,"context_line":"        if power_state \u003d\u003d node.power_state:"},{"line_number":472,"context_line":"            if node.uuid in self.power_state_sync_count:"},{"line_number":473,"context_line":"                self.power_state_sync_count[node.uuid] \u003d 0"},{"line_number":474,"context_line":"            return"},{"line_number":475,"context_line":""},{"line_number":476,"context_line":"        if not CONF.conductor.force_power_state_during_sync:"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAWH%2F%2B62E%3D","line":473,"in_reply_to":"AAAAWH%2F%2B7Lk%3D","updated":"2014-03-21 18:28:57.000000000","message":"Done","commit_id":"b42a84bee7f6936389e05ee03ffd87744014ae2f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e3c9e032cd029934be177609e9b102a0b882500b","unresolved":false,"context_lines":[{"line_number":458,"context_line":"        msg \u003d (_(\"During sync_power_state, max retries exceeded \""},{"line_number":459,"context_line":"                  \"for node %(node)s, node state %(actual)s \""},{"line_number":460,"context_line":"                  \"does not match expected state \u0027%(state)s\u0027. \""},{"line_number":461,"context_line":"                  \"Updating DB state to \u0027%(actual)s\u0027 \""},{"line_number":462,"context_line":"                  \"Switching node to maintenance mode.\"),"},{"line_number":463,"context_line":"                  {\u0027node\u0027: node.uuid, \u0027actual\u0027: actual_power_state,"},{"line_number":464,"context_line":"                   \u0027state\u0027: node.power_state})"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F%2Bmvw%3D","line":461,"updated":"2014-03-25 16:12:46.000000000","message":"Missing a period at the end of this sentence.","commit_id":"65098bcf6576526200a5c946c8aa12352d8e33d3"}],"ironic/tests/conductor/test_manager.py":[{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"7db8051c8ffb99b22c26f5eb0cd99e201a4fdc88","unresolved":false,"context_lines":[{"line_number":160,"context_line":""},{"line_number":161,"context_line":"        with mock.patch.object(self.driver.power,"},{"line_number":162,"context_line":"                               \u0027get_power_state\u0027) as get_power_mock:"},{"line_number":163,"context_line":"            with mock.patch.object(conductor_utils,"},{"line_number":164,"context_line":"                                   \u0027node_power_action\u0027) as npa_mock:"},{"line_number":165,"context_line":"                get_power_mock.return_value \u003d states.POWER_OFF"},{"line_number":166,"context_line":"                # This try wont succeed"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B47A%3D","line":163,"updated":"2014-03-21 23:05:36.000000000","message":"node_power_action is already mocked by L141 -- why are you mocking it again here?","commit_id":"e8a513df423c7b9e302012b6b1bbfbd975e1b329"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"f99b4008fbf4d7047c2ef9700146c5ee1fc74ffc","unresolved":false,"context_lines":[{"line_number":160,"context_line":""},{"line_number":161,"context_line":"        with mock.patch.object(self.driver.power,"},{"line_number":162,"context_line":"                               \u0027get_power_state\u0027) as get_power_mock:"},{"line_number":163,"context_line":"            with mock.patch.object(conductor_utils,"},{"line_number":164,"context_line":"                                   \u0027node_power_action\u0027) as npa_mock:"},{"line_number":165,"context_line":"                get_power_mock.return_value \u003d states.POWER_OFF"},{"line_number":166,"context_line":"                # This try wont succeed"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4Cg%3D","line":163,"in_reply_to":"AAAAWH%2F%2B47A%3D","updated":"2014-03-22 05:56:54.000000000","message":"Because npa_mock is already called once in above code block, i need to recheck if that npa_mock is not called again. I can do this in the second try using self.assertEqual(1, npa_mock.call_count) or i can re-mock the npa_mock.","commit_id":"e8a513df423c7b9e302012b6b1bbfbd975e1b329"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"7db8051c8ffb99b22c26f5eb0cd99e201a4fdc88","unresolved":false,"context_lines":[{"line_number":163,"context_line":"            with mock.patch.object(conductor_utils,"},{"line_number":164,"context_line":"                                   \u0027node_power_action\u0027) as npa_mock:"},{"line_number":165,"context_line":"                get_power_mock.return_value \u003d states.POWER_OFF"},{"line_number":166,"context_line":"                # This try wont succeed"},{"line_number":167,"context_line":"                self.service._sync_power_states(self.context)"},{"line_number":168,"context_line":"                self.assertFalse(npa_mock.called)"},{"line_number":169,"context_line":"                get_power_mock.assert_called_once_with(mock.ANY, mock.ANY)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B468%3D","line":166,"updated":"2014-03-21 23:05:36.000000000","message":"What is causing the second try to fail? It looks like all the context is the same.","commit_id":"e8a513df423c7b9e302012b6b1bbfbd975e1b329"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"f99b4008fbf4d7047c2ef9700146c5ee1fc74ffc","unresolved":false,"context_lines":[{"line_number":163,"context_line":"            with mock.patch.object(conductor_utils,"},{"line_number":164,"context_line":"                                   \u0027node_power_action\u0027) as npa_mock:"},{"line_number":165,"context_line":"                get_power_mock.return_value \u003d states.POWER_OFF"},{"line_number":166,"context_line":"                # This try wont succeed"},{"line_number":167,"context_line":"                self.service._sync_power_states(self.context)"},{"line_number":168,"context_line":"                self.assertFalse(npa_mock.called)"},{"line_number":169,"context_line":"                get_power_mock.assert_called_once_with(mock.ANY, mock.ANY)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4DQ%3D","line":166,"in_reply_to":"AAAAWH%2F%2B468%3D","updated":"2014-03-22 05:56:54.000000000","message":"It fails because the power_state_sync_max_retry count is set to 1 in this testcase, And this is the second time we are trying to sync_power_state. Hence it does not try to set the power state this time","commit_id":"e8a513df423c7b9e302012b6b1bbfbd975e1b329"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"7db8051c8ffb99b22c26f5eb0cd99e201a4fdc88","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                self.service._sync_power_states(self.context)"},{"line_number":168,"context_line":"                self.assertFalse(npa_mock.called)"},{"line_number":169,"context_line":"                get_power_mock.assert_called_once_with(mock.ANY, mock.ANY)"},{"line_number":170,"context_line":"                save_mock.assert_Called_once_with(mock.ANY)"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":"    @mock.patch.object(conductor_utils, \u0027node_power_action\u0027)"},{"line_number":173,"context_line":"    @mock.patch.object(objects.node.Node, \u0027save\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B46g%3D","line":170,"updated":"2014-03-21 23:05:36.000000000","message":"There\u0027s a typo here: s/C/c/\n\nIt\u0027s better when possible (like here) to use self.assert, rather than invoking methods of the mocked object which, if misspelled, will automatically succeed. This would be better written as:\n\n  self.assertEqual(1, get_power_mock.call_count)\n  self.assertEqual(1, save_mock.call_count)\n\nI recognize that many of the existing test cases don\u0027t do this yet. That\u0027s a cleanup effort we should do separately, but we don\u0027t need to continue the antipattern.","commit_id":"e8a513df423c7b9e302012b6b1bbfbd975e1b329"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"f99b4008fbf4d7047c2ef9700146c5ee1fc74ffc","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                self.service._sync_power_states(self.context)"},{"line_number":168,"context_line":"                self.assertFalse(npa_mock.called)"},{"line_number":169,"context_line":"                get_power_mock.assert_called_once_with(mock.ANY, mock.ANY)"},{"line_number":170,"context_line":"                save_mock.assert_Called_once_with(mock.ANY)"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":"    @mock.patch.object(conductor_utils, \u0027node_power_action\u0027)"},{"line_number":173,"context_line":"    @mock.patch.object(objects.node.Node, \u0027save\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4CY%3D","line":170,"in_reply_to":"AAAAWH%2F%2B46g%3D","updated":"2014-03-22 05:56:54.000000000","message":"Done","commit_id":"e8a513df423c7b9e302012b6b1bbfbd975e1b329"},{"author":{"_account_id":8412,"name":"Mike Durnosvistov","email":"glacierr.dev@gmail.com","username":"mdurnosvistov"},"change_message_id":"2cfe57086ed89ce5e7833bc646ae1c30952ff650","unresolved":false,"context_lines":[{"line_number":168,"context_line":"                                             states.POWER_ON)"},{"line_number":169,"context_line":"            self.assertEqual(0, save_mock.call_count)"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"        with mock.patch.object(self.driver.power,"},{"line_number":172,"context_line":"                               \u0027get_power_state\u0027) as get_power_mock:"},{"line_number":173,"context_line":"            with mock.patch.object(conductor_utils,"},{"line_number":174,"context_line":"                                   \u0027node_power_action\u0027) as npa_mock:"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAWH%2F%2ByZE%3D","line":171,"updated":"2014-03-24 11:19:59.000000000","message":"You do not need to re-Mock, you should do:\n    get_power_mock.reset_mock()\n    npa_mock.reset_mock()","commit_id":"bd8f9fd72976355136f6367e7bbfb4914667d5fe"},{"author":{"_account_id":6124,"name":"Rohan Kanade","email":"openstack@rohankanade.com","username":"kanaderohan"},"change_message_id":"d1b99780fc467500be10508aee65bfcdfa9da04b","unresolved":false,"context_lines":[{"line_number":168,"context_line":"                                             states.POWER_ON)"},{"line_number":169,"context_line":"            self.assertEqual(0, save_mock.call_count)"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"        with mock.patch.object(self.driver.power,"},{"line_number":172,"context_line":"                               \u0027get_power_state\u0027) as get_power_mock:"},{"line_number":173,"context_line":"            with mock.patch.object(conductor_utils,"},{"line_number":174,"context_line":"                                   \u0027node_power_action\u0027) as npa_mock:"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAWH%2F%2BxkU%3D","line":171,"in_reply_to":"AAAAWH%2F%2ByZE%3D","updated":"2014-03-24 13:31:23.000000000","message":"Done, Thanks :)","commit_id":"bd8f9fd72976355136f6367e7bbfb4914667d5fe"}]}
