)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a1209baa0d6f5ed8ef650f47e30e6146e47de484","unresolved":false,"context_lines":[{"line_number":19,"context_line":"particular instance will have been lost when the compute manager"},{"line_number":20,"context_line":"stopped."},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"bug 1197024"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"Change-Id: I7b116d8154036c43b0feb23f5669f52358408d2b"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"AAAATH%2F%2FSM4%3D","line":22,"updated":"2013-10-18 12:48:21.000000000","message":"This should be Closes-Bug: #1197024","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"}],"nova/compute/manager.py":[{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"2d6cb672df3d29d6beeee14376a4ab5bf34ec5d2","unresolved":false,"context_lines":[{"line_number":731,"context_line":"                              \u0027firewall rules\u0027), instance\u003dinstance)"},{"line_number":732,"context_line":"        #the instance may have been  left in a transient state"},{"line_number":733,"context_line":"        #after a service restart"},{"line_number":734,"context_line":"        self._set_stable_state(context, instance)"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":""},{"line_number":737,"context_line":"    def handle_lifecycle_event(self, event):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FgBs%3D","line":734,"updated":"2013-09-25 17:25:54.000000000","message":"Since there is already code at the start of _init_instance() that handles, for example, partial deletion it feels that it would be more logical to add these cases in there rather than a seperate function that\u0027s called at the end.   For example the task_state\u003d\u003dDeleting could be part of the vm_state\u003d\u003dDeleted logic","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"dd705d0a353b3dc1f628ec8d0a56d106258aaab8","unresolved":false,"context_lines":[{"line_number":731,"context_line":"                              \u0027firewall rules\u0027), instance\u003dinstance)"},{"line_number":732,"context_line":"        #the instance may have been  left in a transient state"},{"line_number":733,"context_line":"        #after a service restart"},{"line_number":734,"context_line":"        self._set_stable_state(context, instance)"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":""},{"line_number":737,"context_line":"    def handle_lifecycle_event(self, event):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FJFs%3D","line":734,"in_reply_to":"AAAAS3%2F%2FgBs%3D","updated":"2013-10-03 15:51:24.000000000","message":"I haven\u0027t merged these yet. TBH I was wary of making _init_instance() much bigger. I thought it more responsible (and testable) to keep this addition discreet.","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"2d6cb672df3d29d6beeee14376a4ab5bf34ec5d2","unresolved":false,"context_lines":[{"line_number":803,"context_line":"        if instance[\u0027vm_state\u0027] \u003d\u003d vm_states.ERROR:"},{"line_number":804,"context_line":"            return"},{"line_number":805,"context_line":""},{"line_number":806,"context_line":"        if instance[\u0027task_state\u0027] \u003d\u003d task_states.DELETING:"},{"line_number":807,"context_line":"            return"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"        if instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FgA4%3D","line":806,"updated":"2013-09-25 17:25:54.000000000","message":"This shouldn\u0027t be a no-op - it should re-trigger the delete.  There is already code for vm_state\u003d\u003dDELETING at the start of init_instance()","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"dd705d0a353b3dc1f628ec8d0a56d106258aaab8","unresolved":false,"context_lines":[{"line_number":803,"context_line":"        if instance[\u0027vm_state\u0027] \u003d\u003d vm_states.ERROR:"},{"line_number":804,"context_line":"            return"},{"line_number":805,"context_line":""},{"line_number":806,"context_line":"        if instance[\u0027task_state\u0027] \u003d\u003d task_states.DELETING:"},{"line_number":807,"context_line":"            return"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"        if instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FJGM%3D","line":806,"in_reply_to":"AAAAS3%2F%2FgA4%3D","updated":"2013-10-03 15:51:24.000000000","message":"Done","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"2d6cb672df3d29d6beeee14376a4ab5bf34ec5d2","unresolved":false,"context_lines":[{"line_number":806,"context_line":"        if instance[\u0027task_state\u0027] \u003d\u003d task_states.DELETING:"},{"line_number":807,"context_line":"            return"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"        if instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING:"},{"line_number":810,"context_line":"            #compute stopped before instance was fully spawned so set"},{"line_number":811,"context_line":"            #to ERROR state"},{"line_number":812,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2Ff%2B0%3D","line":809,"updated":"2013-09-25 17:25:54.000000000","message":"I think its *mostly* safe to do this because although the API code sets the initial state to Building(Scheduling) it doesn\u0027t set the host field, and so we wouldn\u0027t be processing the instance here if the create message was still in transit via the scheduler.   \n\nHowever if the request is rescheduled the state back to will be set to Building(Scheduling) by  _reschedule_or_error, but the host value doesn\u0027t look like it gets cleared, and you don\u0027t want to put an instance into Error that is actually being rescheduled\n\nWould be worth as part of this change clearing the host value in _reschedule_or_error to make this safe\n \nShould extend this to also include vm_states.REBUILDING, as the same logic applies.\n\nWorth adding a comment to this effect in the code as to why this is safe.","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"dd705d0a353b3dc1f628ec8d0a56d106258aaab8","unresolved":false,"context_lines":[{"line_number":806,"context_line":"        if instance[\u0027task_state\u0027] \u003d\u003d task_states.DELETING:"},{"line_number":807,"context_line":"            return"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"        if instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING:"},{"line_number":810,"context_line":"            #compute stopped before instance was fully spawned so set"},{"line_number":811,"context_line":"            #to ERROR state"},{"line_number":812,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FJGI%3D","line":809,"in_reply_to":"AAAAS3%2F%2Ff%2B0%3D","updated":"2013-10-03 15:51:24.000000000","message":"Done","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"2d6cb672df3d29d6beeee14376a4ab5bf34ec5d2","unresolved":false,"context_lines":[{"line_number":812,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":813,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":814,"context_line":""},{"line_number":815,"context_line":"        if instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":816,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":817,"context_line":"                                      task_states.SCHEDULING,"},{"line_number":818,"context_line":"                                      task_states.NETWORKING,"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2Ff90%3D","line":815,"updated":"2013-09-25 17:25:54.000000000","message":"I don\u0027t believe these occur outside of a vm_state of Building or Rebuilding, so maybe don\u0027t need this block as well as the one above","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"dd705d0a353b3dc1f628ec8d0a56d106258aaab8","unresolved":false,"context_lines":[{"line_number":812,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":813,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":814,"context_line":""},{"line_number":815,"context_line":"        if instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":816,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":817,"context_line":"                                      task_states.SCHEDULING,"},{"line_number":818,"context_line":"                                      task_states.NETWORKING,"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FJGc%3D","line":815,"in_reply_to":"AAAAS3%2F%2Ff90%3D","updated":"2013-10-03 15:51:24.000000000","message":"Done","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"2d6cb672df3d29d6beeee14376a4ab5bf34ec5d2","unresolved":false,"context_lines":[{"line_number":830,"context_line":"            #compute stopped before snapshot happened so reset to"},{"line_number":831,"context_line":"            #\u0027ACTIVE None\u0027 state"},{"line_number":832,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":833,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ACTIVE)"},{"line_number":834,"context_line":""},{"line_number":835,"context_line":"    def pre_start_hook(self):"},{"line_number":836,"context_line":"        \"\"\"After the service is initialized, but before we fully bring"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2Ff9k%3D","line":833,"updated":"2013-09-25 17:25:54.000000000","message":"Should also include task_states of rebooting and rebooting_hard;  \nThere is a slight concern with these that because the task_state is set in the API it could be that the message is still on the queue rather than being an interrupted operation.   The best way to disambiguate these is (I think) to add new task_states that can be set in the API  (reboot-pending  soft-reboot-pending) and only change to rebooting, soft-rebooting) when the request is started on the compute manager.   Then you can apply the logic of if the power_sate is running then the operation completed so just clear the task_state.  If the power_state is not running, restart the reboot.\n\nSame logic can be applied to powering_off / powering_on","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"dd705d0a353b3dc1f628ec8d0a56d106258aaab8","unresolved":false,"context_lines":[{"line_number":830,"context_line":"            #compute stopped before snapshot happened so reset to"},{"line_number":831,"context_line":"            #\u0027ACTIVE None\u0027 state"},{"line_number":832,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":833,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ACTIVE)"},{"line_number":834,"context_line":""},{"line_number":835,"context_line":"    def pre_start_hook(self):"},{"line_number":836,"context_line":"        \"\"\"After the service is initialized, but before we fully bring"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAS3%2F%2FJGQ%3D","line":833,"in_reply_to":"AAAAS3%2F%2Ff9k%3D","updated":"2013-10-03 15:51:24.000000000","message":"Still looking at a way to deal with this situation.","commit_id":"6af59d271dffa25ad52873539aa5ac3b269f5934"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":229,"context_line":"    def decorated_function(self, context, *args, **kwargs):"},{"line_number":230,"context_line":"        expected_attrs \u003d [\u0027metadata\u0027, \u0027system_metadata\u0027]"},{"line_number":231,"context_line":"        instance \u003d kwargs[\u0027instance\u0027]"},{"line_number":232,"context_line":"        sys_meta \u003d instance.system_metadata"},{"line_number":233,"context_line":"        original_state \u003d sys_meta.get(\u0027manager_handoff_state\u0027)"},{"line_number":234,"context_line":"        sys_meta[\u0027manager_handoff_state\u0027] \u003d instance.task_state"},{"line_number":235,"context_line":"        instance.system_metadata \u003d sys_meta"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSRc%3D","line":232,"updated":"2013-10-18 12:47:17.000000000","message":"So the instance is assumed to be an object, are all the methods that are using this decorator supporting objects now?  I see a few below (backup, rebuild, live snapshot) that don\u0027t have the object_compat decorator.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":229,"context_line":"    def decorated_function(self, context, *args, **kwargs):"},{"line_number":230,"context_line":"        expected_attrs \u003d [\u0027metadata\u0027, \u0027system_metadata\u0027]"},{"line_number":231,"context_line":"        instance \u003d kwargs[\u0027instance\u0027]"},{"line_number":232,"context_line":"        sys_meta \u003d instance.system_metadata"},{"line_number":233,"context_line":"        original_state \u003d sys_meta.get(\u0027manager_handoff_state\u0027)"},{"line_number":234,"context_line":"        sys_meta[\u0027manager_handoff_state\u0027] \u003d instance.task_state"},{"line_number":235,"context_line":"        instance.system_metadata \u003d sys_meta"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FRzc%3D","line":232,"in_reply_to":"AAAATH%2F%2FSRc%3D","updated":"2013-10-18 15:20:51.000000000","message":"Good point, I\u0027ll explicitly grab the object.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":235,"context_line":"        instance.system_metadata \u003d sys_meta"},{"line_number":236,"context_line":"        instance.save()"},{"line_number":237,"context_line":"        try:"},{"line_number":238,"context_line":"            print args"},{"line_number":239,"context_line":"            print kwargs"},{"line_number":240,"context_line":"            return function(self, context, *args, **kwargs)"},{"line_number":241,"context_line":"        except exception.UnexpectedTaskStateError:"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSSg%3D","line":238,"updated":"2013-10-18 12:47:17.000000000","message":"Remove the prints here.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":235,"context_line":"        instance.system_metadata \u003d sys_meta"},{"line_number":236,"context_line":"        instance.save()"},{"line_number":237,"context_line":"        try:"},{"line_number":238,"context_line":"            print args"},{"line_number":239,"context_line":"            print kwargs"},{"line_number":240,"context_line":"            return function(self, context, *args, **kwargs)"},{"line_number":241,"context_line":"        except exception.UnexpectedTaskStateError:"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSFg%3D","line":238,"in_reply_to":"AAAATH%2F%2FSSg%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":245,"context_line":"            instance \u003d instance_obj.Instance.get_by_uuid(context,"},{"line_number":246,"context_line":"                                instance.uuid, expected_attrs\u003dexpected_attrs)"},{"line_number":247,"context_line":"            sys_meta \u003d instance.system_metadata"},{"line_number":248,"context_line":"            sys_meta[\u0027manager_handoff_state\u0027] \u003d original_state"},{"line_number":249,"context_line":"            instance.system_metadata \u003d sys_meta"},{"line_number":250,"context_line":"            instance.save()"},{"line_number":251,"context_line":"    return decorated_function"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSR4%3D","line":248,"updated":"2013-10-18 12:47:17.000000000","message":"I can understand why you\u0027re storing the current task_state before calling the function above but I\u0027m not sure why you\u0027re resetting it here, can you add some comments in the finally block that explain why this is needed?","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":245,"context_line":"            instance \u003d instance_obj.Instance.get_by_uuid(context,"},{"line_number":246,"context_line":"                                instance.uuid, expected_attrs\u003dexpected_attrs)"},{"line_number":247,"context_line":"            sys_meta \u003d instance.system_metadata"},{"line_number":248,"context_line":"            sys_meta[\u0027manager_handoff_state\u0027] \u003d original_state"},{"line_number":249,"context_line":"            instance.system_metadata \u003d sys_meta"},{"line_number":250,"context_line":"            instance.save()"},{"line_number":251,"context_line":"    return decorated_function"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSEs%3D","line":248,"in_reply_to":"AAAATH%2F%2FSR4%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":831,"context_line":"        \"\"\"Changes the task_state and vm_state of an instance."},{"line_number":832,"context_line":""},{"line_number":833,"context_line":"        Nova-compute may go down or be restarted while an instance is in a"},{"line_number":834,"context_line":"        transient state. At start up identify instances in these states and"},{"line_number":835,"context_line":"        change their task_state and vm_state if appropriate."},{"line_number":836,"context_line":"        \"\"\""},{"line_number":837,"context_line":"        current_vm_state \u003d instance[\u0027vm_state\u0027]"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSQs%3D","line":834,"updated":"2013-10-18 12:47:17.000000000","message":"The last sentence here made me think this method was going to lookup all instances in the database and process them for setting the stable state, but it only works on the one instance passed in.  Wondering if we can change the wording here a bit?","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":831,"context_line":"        \"\"\"Changes the task_state and vm_state of an instance."},{"line_number":832,"context_line":""},{"line_number":833,"context_line":"        Nova-compute may go down or be restarted while an instance is in a"},{"line_number":834,"context_line":"        transient state. At start up identify instances in these states and"},{"line_number":835,"context_line":"        change their task_state and vm_state if appropriate."},{"line_number":836,"context_line":"        \"\"\""},{"line_number":837,"context_line":"        current_vm_state \u003d instance[\u0027vm_state\u0027]"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSD4%3D","line":834,"in_reply_to":"AAAATH%2F%2FSQs%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        sys_meta \u003d instance[\u0027system_metadata\u0027]"},{"line_number":842,"context_line":"        manager_state \u003d sys_meta.get(\u0027manager_handoff_state\u0027)"},{"line_number":843,"context_line":""},{"line_number":844,"context_line":"        api_set_states \u003d [task_states.IMAGE_BACKUP,"},{"line_number":845,"context_line":"                          task_states.IMAGE_LIVE_SNAPSHOT,"},{"line_number":846,"context_line":"                          task_states.IMAGE_SNAPSHOT,"},{"line_number":847,"context_line":"                          task_states.REBOOTING,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSQk%3D","line":844,"updated":"2013-10-18 12:47:17.000000000","message":"Hmm, would it be better to define a constant in task_states so we don\u0027t have to remember to change it here if there are new task_states added in the future?","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        sys_meta \u003d instance[\u0027system_metadata\u0027]"},{"line_number":842,"context_line":"        manager_state \u003d sys_meta.get(\u0027manager_handoff_state\u0027)"},{"line_number":843,"context_line":""},{"line_number":844,"context_line":"        api_set_states \u003d [task_states.IMAGE_BACKUP,"},{"line_number":845,"context_line":"                          task_states.IMAGE_LIVE_SNAPSHOT,"},{"line_number":846,"context_line":"                          task_states.IMAGE_SNAPSHOT,"},{"line_number":847,"context_line":"                          task_states.REBOOTING,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FRzo%3D","line":844,"in_reply_to":"AAAATH%2F%2FSQk%3D","updated":"2013-10-18 15:20:51.000000000","message":"If a new task state is added then there\u0027s a good chance the logic of how to deal with it after a compute failure would need to be catered for in here anyway I think it\u0027s unlikely it would just plug into an existing list easily so this method would need to be altered either way.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":852,"context_line":"                          task_states.RESCUING,"},{"line_number":853,"context_line":"                          task_states.UNRESCUING]"},{"line_number":854,"context_line":""},{"line_number":855,"context_line":"        if current_task_state in api_set_states and \\"},{"line_number":856,"context_line":"           current_task_state !\u003d manager_state:"},{"line_number":857,"context_line":"            #There are a number of states can be set prior to the request"},{"line_number":858,"context_line":"            #relating to the state getting to the compute manager. We don\u0027t"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSQg%3D","line":855,"updated":"2013-10-18 12:47:17.000000000","message":"Use parenthesis to continue lines, don\u0027t use \\ (per hacking guide).","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":852,"context_line":"                          task_states.RESCUING,"},{"line_number":853,"context_line":"                          task_states.UNRESCUING]"},{"line_number":854,"context_line":""},{"line_number":855,"context_line":"        if current_task_state in api_set_states and \\"},{"line_number":856,"context_line":"           current_task_state !\u003d manager_state:"},{"line_number":857,"context_line":"            #There are a number of states can be set prior to the request"},{"line_number":858,"context_line":"            #relating to the state getting to the compute manager. We don\u0027t"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSCo%3D","line":855,"in_reply_to":"AAAATH%2F%2FSQg%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":854,"context_line":""},{"line_number":855,"context_line":"        if current_task_state in api_set_states and \\"},{"line_number":856,"context_line":"           current_task_state !\u003d manager_state:"},{"line_number":857,"context_line":"            #There are a number of states can be set prior to the request"},{"line_number":858,"context_line":"            #relating to the state getting to the compute manager. We don\u0027t"},{"line_number":859,"context_line":"            #do anything to instances in these states if they haven\u0027t gotten"},{"line_number":860,"context_line":"            # to the compute manager yet."}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSQQ%3D","line":857,"updated":"2013-10-18 12:47:17.000000000","message":"nit: the convention for note blocks like this is to prefix with NOTE(alias) where it would be your IRC alias, e.g. NOTE(dave-mcnally), NOTE(mriedem) for me, etc.  Just in case someone has questions, but you can always use blame too.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":854,"context_line":""},{"line_number":855,"context_line":"        if current_task_state in api_set_states and \\"},{"line_number":856,"context_line":"           current_task_state !\u003d manager_state:"},{"line_number":857,"context_line":"            #There are a number of states can be set prior to the request"},{"line_number":858,"context_line":"            #relating to the state getting to the compute manager. We don\u0027t"},{"line_number":859,"context_line":"            #do anything to instances in these states if they haven\u0027t gotten"},{"line_number":860,"context_line":"            # to the compute manager yet."}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSBQ%3D","line":857,"in_reply_to":"AAAATH%2F%2FSQQ%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":873,"context_line":"            finally:"},{"line_number":874,"context_line":"                return instance"},{"line_number":875,"context_line":""},{"line_number":876,"context_line":"        if current_power_state \u003d\u003d power_state.NOSTATE and \\"},{"line_number":877,"context_line":"           (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or \\"},{"line_number":878,"context_line":"           instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":879,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSP8%3D","line":876,"updated":"2013-10-18 12:47:17.000000000","message":"Don\u0027t use \\ to continue lines.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":873,"context_line":"            finally:"},{"line_number":874,"context_line":"                return instance"},{"line_number":875,"context_line":""},{"line_number":876,"context_line":"        if current_power_state \u003d\u003d power_state.NOSTATE and \\"},{"line_number":877,"context_line":"           (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or \\"},{"line_number":878,"context_line":"           instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":879,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSBM%3D","line":876,"in_reply_to":"AAAATH%2F%2FSP8%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":875,"context_line":""},{"line_number":876,"context_line":"        if current_power_state \u003d\u003d power_state.NOSTATE and \\"},{"line_number":877,"context_line":"           (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or \\"},{"line_number":878,"context_line":"           instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":879,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":880,"context_line":"                                      task_states.SCHEDULING,"},{"line_number":881,"context_line":"                                      task_states.NETWORKING,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSP4%3D","line":878,"updated":"2013-10-18 12:47:17.000000000","message":"Can we define \u0027bring-up\u0027 task states in task_states.py with a constant?","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":877,"context_line":"           (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or \\"},{"line_number":878,"context_line":"           instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":879,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":880,"context_line":"                                      task_states.SCHEDULING,"},{"line_number":881,"context_line":"                                      task_states.NETWORKING,"},{"line_number":882,"context_line":"                                      task_states.SPAWNING]):"},{"line_number":883,"context_line":"            #compute stopped before instance was fully spawned so set"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSP0%3D","line":880,"updated":"2013-10-18 12:47:17.000000000","message":"This is redundant.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":877,"context_line":"           (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or \\"},{"line_number":878,"context_line":"           instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":879,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":880,"context_line":"                                      task_states.SCHEDULING,"},{"line_number":881,"context_line":"                                      task_states.NETWORKING,"},{"line_number":882,"context_line":"                                      task_states.SPAWNING]):"},{"line_number":883,"context_line":"            #compute stopped before instance was fully spawned so set"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSCg%3D","line":880,"in_reply_to":"AAAATH%2F%2FSP0%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":884,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":885,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":886,"context_line":"            #already been scheduled to this particular host."},{"line_number":887,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":888,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        if current_power_state \u003d\u003d power_state.RUNNING and \\"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSPk%3D","line":887,"updated":"2013-10-18 12:47:17.000000000","message":"Probably useful to log a debug message here.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":884,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":885,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":886,"context_line":"            #already been scheduled to this particular host."},{"line_number":887,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":888,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        if current_power_state \u003d\u003d power_state.RUNNING and \\"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FR%2Fw%3D","line":887,"in_reply_to":"AAAATH%2F%2FSPk%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":887,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":888,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        if current_power_state \u003d\u003d power_state.RUNNING and \\"},{"line_number":891,"context_line":"           instance[\u0027task_state\u0027] in [task_states.IMAGE_BACKUP,"},{"line_number":892,"context_line":"                                      task_states.IMAGE_LIVE_SNAPSHOT,"},{"line_number":893,"context_line":"                                      task_states.IMAGE_PENDING_UPLOAD,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSPg%3D","line":890,"updated":"2013-10-18 12:47:17.000000000","message":"Don\u0027t use \\ to continue lines.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":887,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":888,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        if current_power_state \u003d\u003d power_state.RUNNING and \\"},{"line_number":891,"context_line":"           instance[\u0027task_state\u0027] in [task_states.IMAGE_BACKUP,"},{"line_number":892,"context_line":"                                      task_states.IMAGE_LIVE_SNAPSHOT,"},{"line_number":893,"context_line":"                                      task_states.IMAGE_PENDING_UPLOAD,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FR%2Fs%3D","line":890,"in_reply_to":"AAAATH%2F%2FSPg%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":888,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        if current_power_state \u003d\u003d power_state.RUNNING and \\"},{"line_number":891,"context_line":"           instance[\u0027task_state\u0027] in [task_states.IMAGE_BACKUP,"},{"line_number":892,"context_line":"                                      task_states.IMAGE_LIVE_SNAPSHOT,"},{"line_number":893,"context_line":"                                      task_states.IMAGE_PENDING_UPLOAD,"},{"line_number":894,"context_line":"                                      task_states.IMAGE_SNAPSHOT,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSPQ%3D","line":891,"updated":"2013-10-18 12:47:17.000000000","message":"I think we should define a constant list for the task states here.  It\u0027s the same list as api_set_states except for rescue/unrescue isn\u0027t in this list.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":888,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        if current_power_state \u003d\u003d power_state.RUNNING and \\"},{"line_number":891,"context_line":"           instance[\u0027task_state\u0027] in [task_states.IMAGE_BACKUP,"},{"line_number":892,"context_line":"                                      task_states.IMAGE_LIVE_SNAPSHOT,"},{"line_number":893,"context_line":"                                      task_states.IMAGE_PENDING_UPLOAD,"},{"line_number":894,"context_line":"                                      task_states.IMAGE_SNAPSHOT,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FR%2Bw%3D","line":891,"in_reply_to":"AAAATH%2F%2FSPQ%3D","updated":"2013-10-18 15:20:51.000000000","message":"I\u0027m dropping rescue/unrescue as it\u0027s non-trivial to determine how far through the process an instance has gotten and there\u0027s no clear \"safe\" state to revert to.\nHowever these lists aren\u0027t identical (UPLOADING and PENDING_UPLOAD aren\u0027t in both).","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":898,"context_line":"                                      task_states.REBUILDING,"},{"line_number":899,"context_line":"                                      task_states.POWERING_OFF,"},{"line_number":900,"context_line":"                                      task_states.POWERING_ON]:"},{"line_number":901,"context_line":"            #compute stopped before either a task ended or before it began"},{"line_number":902,"context_line":"            #so revert to \u0027ACTIVE None\u0027 state"},{"line_number":903,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":904,"context_line":"                                   task_state\u003dNone, vm_state\u003dvm_states.ACTIVE)"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSO0%3D","line":901,"updated":"2013-10-18 12:47:17.000000000","message":"Log as a debug message.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":898,"context_line":"                                      task_states.REBUILDING,"},{"line_number":899,"context_line":"                                      task_states.POWERING_OFF,"},{"line_number":900,"context_line":"                                      task_states.POWERING_ON]:"},{"line_number":901,"context_line":"            #compute stopped before either a task ended or before it began"},{"line_number":902,"context_line":"            #so revert to \u0027ACTIVE None\u0027 state"},{"line_number":903,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":904,"context_line":"                                   task_state\u003dNone, vm_state\u003dvm_states.ACTIVE)"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FR7s%3D","line":901,"in_reply_to":"AAAATH%2F%2FSO0%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":904,"context_line":"                                   task_state\u003dNone, vm_state\u003dvm_states.ACTIVE)"},{"line_number":905,"context_line":""},{"line_number":906,"context_line":"        if current_power_state not in [power_state.NOSTATE,"},{"line_number":907,"context_line":"                                       power_state.RUNNING] and \\"},{"line_number":908,"context_line":"           instance[\u0027task_state\u0027] in [task_states.REBOOTING_HARD,"},{"line_number":909,"context_line":"                                      task_states.REBUILDING,"},{"line_number":910,"context_line":"                                      task_states.POWERING_OFF,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSOw%3D","line":907,"updated":"2013-10-18 12:47:17.000000000","message":"nix the \\","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":904,"context_line":"                                   task_state\u003dNone, vm_state\u003dvm_states.ACTIVE)"},{"line_number":905,"context_line":""},{"line_number":906,"context_line":"        if current_power_state not in [power_state.NOSTATE,"},{"line_number":907,"context_line":"                                       power_state.RUNNING] and \\"},{"line_number":908,"context_line":"           instance[\u0027task_state\u0027] in [task_states.REBOOTING_HARD,"},{"line_number":909,"context_line":"                                      task_states.REBUILDING,"},{"line_number":910,"context_line":"                                      task_states.POWERING_OFF,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FR%2Bg%3D","line":907,"in_reply_to":"AAAATH%2F%2FSOw%3D","updated":"2013-10-18 15:20:51.000000000","message":"Done","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":905,"context_line":""},{"line_number":906,"context_line":"        if current_power_state not in [power_state.NOSTATE,"},{"line_number":907,"context_line":"                                       power_state.RUNNING] and \\"},{"line_number":908,"context_line":"           instance[\u0027task_state\u0027] in [task_states.REBOOTING_HARD,"},{"line_number":909,"context_line":"                                      task_states.REBUILDING,"},{"line_number":910,"context_line":"                                      task_states.POWERING_OFF,"},{"line_number":911,"context_line":"                                      task_states.POWERING_ON]:"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSN0%3D","line":908,"updated":"2013-10-18 12:47:17.000000000","message":"Maybe another idea for these conditional blocks is at the top of the method (or in a constants file somewhere, maybe task_states, not sure), define a dict where the keys are a list of the power_states and the values are your list of task_states, then you map that to the vm_state you need to set the instance to.  That would cover these last big three conditional blocks where you\u0027re checking power_state and task_state and then setting vm_state\u003dxxx and task_state\u003dNone.  Just a thought, maybe it wouldn\u0027t work...or maybe it would make a debug message to obscure?  But I think a message of something like \"Instance power_state %s and task_state %s on compute startup, setting vm_state to %s.\"","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":905,"context_line":""},{"line_number":906,"context_line":"        if current_power_state not in [power_state.NOSTATE,"},{"line_number":907,"context_line":"                                       power_state.RUNNING] and \\"},{"line_number":908,"context_line":"           instance[\u0027task_state\u0027] in [task_states.REBOOTING_HARD,"},{"line_number":909,"context_line":"                                      task_states.REBUILDING,"},{"line_number":910,"context_line":"                                      task_states.POWERING_OFF,"},{"line_number":911,"context_line":"                                      task_states.POWERING_ON]:"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FR0A%3D","line":908,"in_reply_to":"AAAATH%2F%2FSN0%3D","updated":"2013-10-18 15:20:51.000000000","message":"I can\u0027t think of a particularly elegant way of of pulling this information into a single data structure. the first check looks at the vm_state as well as the task and the last part would map more than one power state to a single list of task states. That\u0027s not to say it\u0027s impossible I just don\u0027t think it would present things any clearer than they are here.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":1288,"context_line":"                {\u0027method\u0027: scheduler_method.func_name,"},{"line_number":1289,"context_line":"                 \u0027num\u0027: retry[\u0027num_attempts\u0027]}, instance_uuid\u003dinstance_uuid)"},{"line_number":1290,"context_line":""},{"line_number":1291,"context_line":"        # reset the task state and clear the host:"},{"line_number":1292,"context_line":"        self._instance_update(context, instance_uuid, task_state\u003dtask_state,"},{"line_number":1293,"context_line":"                              host\u003dNone, hostname\u003dNone)"},{"line_number":1294,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSNU%3D","line":1291,"updated":"2013-10-18 12:47:17.000000000","message":"Maybe add some more explanation here why the host needs to be cleared?  I\u0027m guessing because of how revert_task_state is calling _set_stable_state now?","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"84c79bae13732fa4eb34ca75d066048d9c1fb3a1","unresolved":false,"context_lines":[{"line_number":250,"context_line":"            #There may be an issue getting the instance here but we still"},{"line_number":251,"context_line":"            #let the wrapped function get called where it should be handled"},{"line_number":252,"context_line":"            #correctly"},{"line_number":253,"context_line":"            pass"},{"line_number":254,"context_line":"        try:"},{"line_number":255,"context_line":"            return function(self, context, *args, **kwargs)"},{"line_number":256,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F6F8%3D","line":253,"updated":"2013-10-25 12:28:09.000000000","message":"not even logging a warning?","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"c73b13b1dfa866f2b9bb6424d8ce059006b69e5c","unresolved":false,"context_lines":[{"line_number":250,"context_line":"            #There may be an issue getting the instance here but we still"},{"line_number":251,"context_line":"            #let the wrapped function get called where it should be handled"},{"line_number":252,"context_line":"            #correctly"},{"line_number":253,"context_line":"            pass"},{"line_number":254,"context_line":"        try:"},{"line_number":255,"context_line":"            return function(self, context, *args, **kwargs)"},{"line_number":256,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F5ko%3D","line":253,"in_reply_to":"AAAATn%2F%2F6F8%3D","updated":"2013-10-25 15:26:32.000000000","message":"I\u0027ve added one now.","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"84c79bae13732fa4eb34ca75d066048d9c1fb3a1","unresolved":false,"context_lines":[{"line_number":255,"context_line":"            return function(self, context, *args, **kwargs)"},{"line_number":256,"context_line":"        except Exception:"},{"line_number":257,"context_line":"            #allow other decorators to handle exceptions"},{"line_number":258,"context_line":"            raise"},{"line_number":259,"context_line":"        finally:"},{"line_number":260,"context_line":"            #Resetting the manager_handoff_state once the wrapped function"},{"line_number":261,"context_line":"            #completes so the value correctly represents whether the operation"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F6F4%3D","line":258,"updated":"2013-10-25 12:28:09.000000000","message":"this is a noop, isn\u0027t it?","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"c73b13b1dfa866f2b9bb6424d8ce059006b69e5c","unresolved":false,"context_lines":[{"line_number":255,"context_line":"            return function(self, context, *args, **kwargs)"},{"line_number":256,"context_line":"        except Exception:"},{"line_number":257,"context_line":"            #allow other decorators to handle exceptions"},{"line_number":258,"context_line":"            raise"},{"line_number":259,"context_line":"        finally:"},{"line_number":260,"context_line":"            #Resetting the manager_handoff_state once the wrapped function"},{"line_number":261,"context_line":"            #completes so the value correctly represents whether the operation"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F5rg%3D","line":258,"in_reply_to":"AAAATn%2F%2F6F4%3D","updated":"2013-10-25 15:26:32.000000000","message":"Removed now.","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"84c79bae13732fa4eb34ca75d066048d9c1fb3a1","unresolved":false,"context_lines":[{"line_number":270,"context_line":"                self.conductor_api.instance_update(context, instance_uuid,"},{"line_number":271,"context_line":"                                               system_metadata\u003dsys_meta)"},{"line_number":272,"context_line":"            except Exception:"},{"line_number":273,"context_line":"                pass"},{"line_number":274,"context_line":"    return decorated_function"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F6Fw%3D","line":273,"updated":"2013-10-25 12:28:09.000000000","message":"this is not very DRY... how about:\n\n    def swap_sys_meta(..., new_state\u003dNone):\n        instance_ref \u003d ...\n        sys_meta \u003d ...\n        prev_state \u003d sys.meta.get(manager_handoff_state)\n        sys_meta[\u0027manager_handoff_state\u0027] \u003d new_state if new_state else instance_ref[\u0027task_state\u0027]\n        ... instance_update(...)\n        return prev_state\n\n(or similar). Then the main function is more or less:\n\n    prev_state \u003d swap_sys_meta(...)\n    return function(...)\n    swap_sys_meta(..., new_state\u003dprev_state)\n\nplus the exception handling","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"c73b13b1dfa866f2b9bb6424d8ce059006b69e5c","unresolved":false,"context_lines":[{"line_number":270,"context_line":"                self.conductor_api.instance_update(context, instance_uuid,"},{"line_number":271,"context_line":"                                               system_metadata\u003dsys_meta)"},{"line_number":272,"context_line":"            except Exception:"},{"line_number":273,"context_line":"                pass"},{"line_number":274,"context_line":"    return decorated_function"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F5kg%3D","line":273,"in_reply_to":"AAAATn%2F%2F6Fw%3D","updated":"2013-10-25 15:26:32.000000000","message":"Done","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"3c7d35ff52a0efbd19fb5e743e990a51ef200022","unresolved":false,"context_lines":[{"line_number":267,"context_line":"            #There may be an issue getting the instance here but we still"},{"line_number":268,"context_line":"            #let the wrapped function get called where it should be handled"},{"line_number":269,"context_line":"            #correctly"},{"line_number":270,"context_line":"            LOG.error(_(\u0027Error: %s\u0027) % e, instance\u003dinstance)"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        finally:"},{"line_number":273,"context_line":"            #Resetting the manager_handoff_state once the wrapped function"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAATn%2F%2F5Rw%3D","line":270,"updated":"2013-10-25 15:28:58.000000000","message":"LOG.exception(...) will report the traceback automatically, so it\u0027s probably better to use that.","commit_id":"97aeadee9f5861ef3b078f1bcec9be591419fedf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"30585f4703b13c2726f1ee18c5a30906cebac404","unresolved":false,"context_lines":[{"line_number":267,"context_line":"            #There may be an issue getting the instance here but we still"},{"line_number":268,"context_line":"            #let the wrapped function get called where it should be handled"},{"line_number":269,"context_line":"            #correctly"},{"line_number":270,"context_line":"            LOG.error(_(\u0027Error: %s\u0027) % e, instance\u003dinstance)"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        finally:"},{"line_number":273,"context_line":"            #Resetting the manager_handoff_state once the wrapped function"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAATn%2F%2F4n4%3D","line":270,"in_reply_to":"AAAATn%2F%2F5Rw%3D","updated":"2013-10-25 17:42:55.000000000","message":"Given the comment, this doesn\u0027t even sound like an error case, maybe debug is better here.  If you expect it to fail in the called function, we probably don\u0027t need a big stack trace dump here.","commit_id":"97aeadee9f5861ef3b078f1bcec9be591419fedf"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d232891580162b374bee211a2ab4734e93f9f3c7","unresolved":false,"context_lines":[{"line_number":228,"context_line":"    \"\"\""},{"line_number":229,"context_line":"    expected_attrs \u003d [\u0027system_metadata\u0027]"},{"line_number":230,"context_line":"    instance_ref \u003d conductor_api.instance_get_by_uuid(context,"},{"line_number":231,"context_line":"                          instance_uuid, columns_to_join\u003dexpected_attrs)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    sys_meta \u003d utils.metadata_to_dict(instance_ref[\u0027system_metadata\u0027])"},{"line_number":234,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAATn%2F%2F0cQ%3D","line":231,"updated":"2013-10-28 14:25:48.000000000","message":"This should use objects.","commit_id":"6c737bd999433260ba9ff185a95dbe1e6541e2f9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"93b70e2e414fbb363e721bccd5494ed839337a56","unresolved":false,"context_lines":[{"line_number":228,"context_line":"    \"\"\""},{"line_number":229,"context_line":"    expected_attrs \u003d [\u0027system_metadata\u0027]"},{"line_number":230,"context_line":"    instance_ref \u003d conductor_api.instance_get_by_uuid(context,"},{"line_number":231,"context_line":"                          instance_uuid, columns_to_join\u003dexpected_attrs)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    sys_meta \u003d utils.metadata_to_dict(instance_ref[\u0027system_metadata\u0027])"},{"line_number":234,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAATn%2F%2F0AA%3D","line":231,"in_reply_to":"AAAATn%2F%2F0QU%3D","updated":"2013-10-28 16:40:16.000000000","message":"It doesn\u0027t matter if the method you\u0027re using is receiving an instance object or an old-style dict, the way you\u0027re doing this. It should be pointed out, however, that your decorator makes sure that the instance coming into the manager is stale, and if it does any updates to the database with the instance it receives that include system_metadata, your manager_handoff_state element will be removed from the database.","commit_id":"6c737bd999433260ba9ff185a95dbe1e6541e2f9"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"b1d3923176095a4ccaa12400140e2bb262cbe772","unresolved":false,"context_lines":[{"line_number":228,"context_line":"    \"\"\""},{"line_number":229,"context_line":"    expected_attrs \u003d [\u0027system_metadata\u0027]"},{"line_number":230,"context_line":"    instance_ref \u003d conductor_api.instance_get_by_uuid(context,"},{"line_number":231,"context_line":"                          instance_uuid, columns_to_join\u003dexpected_attrs)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    sys_meta \u003d utils.metadata_to_dict(instance_ref[\u0027system_metadata\u0027])"},{"line_number":234,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAATn%2F%2F0QU%3D","line":231,"in_reply_to":"AAAATn%2F%2F0cQ%3D","updated":"2013-10-28 15:12:29.000000000","message":"I don\u0027t think it\u0027s guaranteed that the instance in the wrapped method is an object so that\u0027s why I\u0027m getting it this way, I could hit the DB directly but I didn\u0027t think that was encouraged anymore.","commit_id":"6c737bd999433260ba9ff185a95dbe1e6541e2f9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d232891580162b374bee211a2ab4734e93f9f3c7","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        sys_meta[\u0027manager_handoff_state\u0027] \u003d instance_ref[\u0027task_state\u0027]"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"    conductor_api.instance_update(context, instance_uuid,"},{"line_number":242,"context_line":"                                               system_metadata\u003dsys_meta)"},{"line_number":243,"context_line":"    return original_state"},{"line_number":244,"context_line":""},{"line_number":245,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAATn%2F%2F0cM%3D","line":242,"updated":"2013-10-28 14:25:48.000000000","message":"Same.","commit_id":"6c737bd999433260ba9ff185a95dbe1e6541e2f9"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d3a3f2377bc87005e64aa89b0e4c3a63c8429ffe","unresolved":false,"context_lines":[{"line_number":661,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":662,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            #already been scheduled to this particular host."},{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly\""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":667,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"}],"source_content_type":"text/x-python","patch_set":21,"id":"AAAATn%2F%2FS4s%3D","line":664,"updated":"2013-11-11 14:22:54.000000000","message":"please add a space at the end of the sentence","commit_id":"48a7ebd81c68c56eb0e5d299b9890b56499de8b5"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"79cd08df4c64f13145579c7079d9083663842be8","unresolved":false,"context_lines":[{"line_number":661,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":662,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            #already been scheduled to this particular host."},{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly\""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":667,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"}],"source_content_type":"text/x-python","patch_set":21,"id":"AAAATn%2F%2FSzY%3D","line":664,"in_reply_to":"AAAATn%2F%2FS4s%3D","updated":"2013-11-11 14:43:18.000000000","message":"Done","commit_id":"48a7ebd81c68c56eb0e5d299b9890b56499de8b5"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"unresolved":false,"context_lines":[{"line_number":654,"context_line":""},{"line_number":655,"context_line":"        if (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or"},{"line_number":656,"context_line":"            instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":657,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":658,"context_line":"                                      task_states.NETWORKING,"},{"line_number":659,"context_line":"                                      task_states.SPAWNING]):"},{"line_number":660,"context_line":"            #compute stopped before instance was fully spawned so set"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FJ1g%3D","line":657,"updated":"2013-11-13 17:15:03.000000000","message":"This and the following lines should be indented +1 space to line up with the one above it.","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"79cd08df4c64f13145579c7079d9083663842be8","unresolved":false,"context_lines":[{"line_number":654,"context_line":""},{"line_number":655,"context_line":"        if (instance[\u0027vm_state\u0027] \u003d\u003d vm_states.BUILDING or"},{"line_number":656,"context_line":"            instance[\u0027task_state\u0027] in [task_states.SCHEDULING,"},{"line_number":657,"context_line":"                                      task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":658,"context_line":"                                      task_states.NETWORKING,"},{"line_number":659,"context_line":"                                      task_states.SPAWNING]):"},{"line_number":660,"context_line":"            #compute stopped before instance was fully spawned so set"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FF8g%3D","line":657,"in_reply_to":"AAAATn%2F%2FJ1g%3D","updated":"2013-11-14 14:19:40.000000000","message":"Done","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"unresolved":false,"context_lines":[{"line_number":660,"context_line":"            #compute stopped before instance was fully spawned so set"},{"line_number":661,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":662,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            #already been scheduled to this particular host."},{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly \""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FJ1Y%3D","line":663,"updated":"2013-11-13 17:15:03.000000000","message":"Can you put a space between # and the first character of each comment line?","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"79cd08df4c64f13145579c7079d9083663842be8","unresolved":false,"context_lines":[{"line_number":660,"context_line":"            #compute stopped before instance was fully spawned so set"},{"line_number":661,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":662,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            #already been scheduled to this particular host."},{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly \""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FF8c%3D","line":663,"in_reply_to":"AAAATn%2F%2FJ1Y%3D","updated":"2013-11-14 14:19:40.000000000","message":"Done","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"unresolved":false,"context_lines":[{"line_number":661,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":662,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            #already been scheduled to this particular host."},{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly \""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":667,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FJ1U%3D","line":664,"updated":"2013-11-13 17:15:03.000000000","message":"I expect a comma after \"correctly\" will look better in the log :)","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"79cd08df4c64f13145579c7079d9083663842be8","unresolved":false,"context_lines":[{"line_number":661,"context_line":"            #to ERROR state. This is safe to do as the state may be set by the"},{"line_number":662,"context_line":"            #api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            #already been scheduled to this particular host."},{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly \""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":667,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FF8Y%3D","line":664,"in_reply_to":"AAAATn%2F%2FJ1U%3D","updated":"2013-11-14 14:19:40.000000000","message":"Done","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"unresolved":false,"context_lines":[{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly \""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":667,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":668,"context_line":"            return"},{"line_number":669,"context_line":""},{"line_number":670,"context_line":"        net_info \u003d compute_utils.get_nw_info_for_instance(instance)"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FJ1Q%3D","line":667,"updated":"2013-11-13 17:15:03.000000000","message":"Since I\u0027m on a nit-rant, can you also line up task_state with context?","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"79cd08df4c64f13145579c7079d9083663842be8","unresolved":false,"context_lines":[{"line_number":664,"context_line":"            LOG.debug(_(\"Instance failed to spawn correctly \""},{"line_number":665,"context_line":"                        \"setting to ERROR state\"), instance\u003dinstance)"},{"line_number":666,"context_line":"            instance \u003d self._instance_update(context, instance[\u0027uuid\u0027],"},{"line_number":667,"context_line":"                                    task_state\u003dNone, vm_state\u003dvm_states.ERROR)"},{"line_number":668,"context_line":"            return"},{"line_number":669,"context_line":""},{"line_number":670,"context_line":"        net_info \u003d compute_utils.get_nw_info_for_instance(instance)"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAATn%2F%2FF8U%3D","line":667,"in_reply_to":"AAAATn%2F%2FJ1Q%3D","updated":"2013-11-14 14:19:40.000000000","message":"Done","commit_id":"d4251d7a75813301f218e8e7decc504d7579f9c0"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"b5671739bc638bfc75f7f1553f8a9a9fa4ddb428","unresolved":false,"context_lines":[{"line_number":657,"context_line":"                                    task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":658,"context_line":"                                    task_states.NETWORKING,"},{"line_number":659,"context_line":"                                    task_states.SPAWNING]):"},{"line_number":660,"context_line":"            # compute stopped before instance was fully spawned so set"},{"line_number":661,"context_line":"            # to ERROR state. This is safe to do as the state may be set by"},{"line_number":662,"context_line":"            # the api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            # already been scheduled to this particular host."}],"source_content_type":"text/x-python","patch_set":23,"id":"AAAATn%2F%2B6P0%3D","line":660,"updated":"2013-11-19 12:39:03.000000000","message":"We usually add NOTE(name_of_commmitter) for this stuff","commit_id":"5bf8ccdf595fdfda2f700bebaefec4b5afeba5e5"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"bac56e27fb97bb2a4ac67da2bc82d269f06979e2","unresolved":false,"context_lines":[{"line_number":657,"context_line":"                                    task_states.BLOCK_DEVICE_MAPPING,"},{"line_number":658,"context_line":"                                    task_states.NETWORKING,"},{"line_number":659,"context_line":"                                    task_states.SPAWNING]):"},{"line_number":660,"context_line":"            # compute stopped before instance was fully spawned so set"},{"line_number":661,"context_line":"            # to ERROR state. This is safe to do as the state may be set by"},{"line_number":662,"context_line":"            # the api but the host is not so if we get here the instance has"},{"line_number":663,"context_line":"            # already been scheduled to this particular host."}],"source_content_type":"text/x-python","patch_set":23,"id":"AAAATn%2F%2B1A8%3D","line":660,"in_reply_to":"AAAATn%2F%2B6P0%3D","updated":"2013-11-19 17:03:08.000000000","message":"Done","commit_id":"5bf8ccdf595fdfda2f700bebaefec4b5afeba5e5"}],"nova/tests/compute/test_compute_mgr.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c1214713f128d12c60436eae4b835239b817f396","unresolved":false,"context_lines":[{"line_number":718,"context_line":"                do_raise\u003dTrue)"},{"line_number":719,"context_line":""},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"    def test_set_stable_state_error(self):"},{"line_number":722,"context_line":"        def fake_get_power_state(context, instance):"},{"line_number":723,"context_line":"            return power_state.RUNNING"},{"line_number":724,"context_line":"        inst \u003d fake_instance.fake_db_instance("}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FSNA%3D","line":721,"updated":"2013-10-18 12:47:17.000000000","message":"Should be using mock for all new unit tests, see https://review.openstack.org/#/c/52519/ for examples.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"55003f29eab166eda5b3dcdb842e7282e0e64f58","unresolved":false,"context_lines":[{"line_number":718,"context_line":"                do_raise\u003dTrue)"},{"line_number":719,"context_line":""},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"    def test_set_stable_state_error(self):"},{"line_number":722,"context_line":"        def fake_get_power_state(context, instance):"},{"line_number":723,"context_line":"            return power_state.RUNNING"},{"line_number":724,"context_line":"        inst \u003d fake_instance.fake_db_instance("}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATH%2F%2FRm0%3D","line":721,"in_reply_to":"AAAATH%2F%2FSNA%3D","updated":"2013-10-18 15:20:51.000000000","message":"Looking at this now.","commit_id":"69029d0e37cf6ea50d5774ed70d8ece6a63aafe2"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"84c79bae13732fa4eb34ca75d066048d9c1fb3a1","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                             return_value\u003dpower_state.RUNNING)"},{"line_number":727,"context_line":"        ) as ("},{"line_number":728,"context_line":"            _get_power_state"},{"line_number":729,"context_line":"        ):"},{"line_number":730,"context_line":"            inst \u003d fake_instance.fake_db_instance("},{"line_number":731,"context_line":"                    vm_state\u003dvm_states.ERROR,"},{"line_number":732,"context_line":"                    task_state\u003dNone,"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F6FU%3D","line":729,"updated":"2013-10-25 12:28:09.000000000","message":"This looks like very creative indentation... why take \")\" to the same level as \"with\" started.","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"9f6b3e4d85e88bdc88ba699b7693de6c8cb1c6a9","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                             return_value\u003dpower_state.RUNNING)"},{"line_number":727,"context_line":"        ) as ("},{"line_number":728,"context_line":"            _get_power_state"},{"line_number":729,"context_line":"        ):"},{"line_number":730,"context_line":"            inst \u003d fake_instance.fake_db_instance("},{"line_number":731,"context_line":"                    vm_state\u003dvm_states.ERROR,"},{"line_number":732,"context_line":"                    task_state\u003dNone,"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F4%2Bc%3D","line":729,"in_reply_to":"AAAATn%2F%2F6DA%3D","updated":"2013-10-25 16:25:48.000000000","message":"Don\u0027t feel bad, I totally copied the structure from some other tests in test_compute_manager and network tests somewhere that were using mock with nested context.","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"c73b13b1dfa866f2b9bb6424d8ce059006b69e5c","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                             return_value\u003dpower_state.RUNNING)"},{"line_number":727,"context_line":"        ) as ("},{"line_number":728,"context_line":"            _get_power_state"},{"line_number":729,"context_line":"        ):"},{"line_number":730,"context_line":"            inst \u003d fake_instance.fake_db_instance("},{"line_number":731,"context_line":"                    vm_state\u003dvm_states.ERROR,"},{"line_number":732,"context_line":"                    task_state\u003dNone,"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2F6DA%3D","line":729,"in_reply_to":"AAAATn%2F%2F6FU%3D","updated":"2013-10-25 15:26:32.000000000","message":"TBH I copied the structure here: https://review.openstack.org/#/c/52519/4/nova/tests/compute/test_compute.py\n\nMatt Riedemann pointed to that as an example of the use of mock and with the recent move to it I hadn\u0027t used it before so I just used that as a template.","commit_id":"a19f4ae8a95c71014a03dc2691552210ea4491ee"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"b5671739bc638bfc75f7f1553f8a9a9fa4ddb428","unresolved":false,"context_lines":[{"line_number":366,"context_line":"                call \u003d mock.call(self.context, \u0027foo\u0027,"},{"line_number":367,"context_line":"                                 task_state\u003dNone,"},{"line_number":368,"context_line":"                                 vm_state\u003dvm_states.ERROR)"},{"line_number":369,"context_line":"                _instance_update.assert_has_calls([call])"},{"line_number":370,"context_line":""},{"line_number":371,"context_line":"    def test_get_instances_on_driver(self):"},{"line_number":372,"context_line":"        fake_context \u003d context.get_admin_context()"}],"source_content_type":"text/x-python","patch_set":23,"id":"AAAATn%2F%2B6O4%3D","line":369,"updated":"2013-11-19 12:39:03.000000000","message":"It would be nice if we can add some kind of hint as to which bit of the loop failed?\n\nI would be tempted to split this out into multiple tests, but thats probably overkill.","commit_id":"5bf8ccdf595fdfda2f700bebaefec4b5afeba5e5"},{"author":{"_account_id":1882,"name":"dave-mcnally","email":"dave.mcnally@hpe.com","username":"dave-mcnally"},"change_message_id":"bac56e27fb97bb2a4ac67da2bc82d269f06979e2","unresolved":false,"context_lines":[{"line_number":366,"context_line":"                call \u003d mock.call(self.context, \u0027foo\u0027,"},{"line_number":367,"context_line":"                                 task_state\u003dNone,"},{"line_number":368,"context_line":"                                 vm_state\u003dvm_states.ERROR)"},{"line_number":369,"context_line":"                _instance_update.assert_has_calls([call])"},{"line_number":370,"context_line":""},{"line_number":371,"context_line":"    def test_get_instances_on_driver(self):"},{"line_number":372,"context_line":"        fake_context \u003d context.get_admin_context()"}],"source_content_type":"text/x-python","patch_set":23,"id":"AAAATn%2F%2B01U%3D","line":369,"in_reply_to":"AAAATn%2F%2B6O4%3D","updated":"2013-11-19 17:03:08.000000000","message":"I\u0027ve split them out following a pattern I\u0027ve seen elsewhere in the tests. I think it\u0027s a workable solution, take a look and see.","commit_id":"5bf8ccdf595fdfda2f700bebaefec4b5afeba5e5"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"6041143f474b650e8515797a61aaebc9cc8584f9","unresolved":false,"context_lines":[{"line_number":360,"context_line":"        instance.uuid \u003d \u0027foo\u0027"},{"line_number":361,"context_line":"        instance.vm_state \u003d None"},{"line_number":362,"context_line":"        instance.task_state \u003d task_states.SCHEDULING"},{"line_number":363,"context_line":"        self._test_init_instance_sets_building_tasks_error(instance)"},{"line_number":364,"context_line":""},{"line_number":365,"context_line":"    def test_init_instance_sets_building_tasks_error_block_device(self):"},{"line_number":366,"context_line":"        instance \u003d instance_obj.Instance(self.context)"}],"source_content_type":"text/x-python","patch_set":25,"id":"AAAATn%2F%2Bw2s%3D","line":363,"updated":"2013-11-20 14:43:08.000000000","message":"This could be dry-er but its a big improvement. I would have just passed in the task_state to _test_init_instance, but hey.","commit_id":"b6a5307d8fd13bc99ef18f7fd4e2fe71c71baf27"}]}
