)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3c62e4c683f207c080289297362f054f6c980315","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"There is the periodic task _sync_power_states which aligns the"},{"line_number":10,"context_line":"states between the database and the hypervisor. In some cases"},{"line_number":11,"context_line":"shutting down the instance problematic and that action may be"},{"line_number":12,"context_line":"something which the admin decides to do instead of having this"},{"line_number":13,"context_line":"done by the compute manager. That may lead to active instances"},{"line_number":14,"context_line":"being shutdown due to a legitimate outage on the driver backend."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_03a75fbd","line":11,"updated":"2015-08-21 13:43:18.000000000","message":"Again, if the admin doesn\u0027t want this task to automatically shut down the instances, and he wants to manage that himself, he can disable this task.\n\nI\u0027m just not that crazy about the admin doing this stuff outside of nova.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ed4e5b81ff6be04379b788f5c6bd8bd7bbef6118","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"There is the periodic task _sync_power_states which aligns the"},{"line_number":10,"context_line":"states between the database and the hypervisor. In some cases"},{"line_number":11,"context_line":"shutting down the instance problematic and that action may be"},{"line_number":12,"context_line":"something which the admin decides to do instead of having this"},{"line_number":13,"context_line":"done by the compute manager. That may lead to active instances"},{"line_number":14,"context_line":"being shutdown due to a legitimate outage on the driver backend."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_1a4a5d56","line":11,"in_reply_to":"fa1b9901_03a75fbd","updated":"2015-08-21 16:01:33.000000000","message":"Matt, there are issues with that - the state of an instance may not be updated correctly and the tenant may not be able to delete that. Disabling the periodic task is not helpful and causes more problems. I am not sure if you have run into these, but I do on a daily basis and this patch helps with that.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3c62e4c683f207c080289297362f054f6c980315","unresolved":false,"context_lines":[{"line_number":21,"context_line":"            decide the course of action"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_23c38339","line":24,"updated":"2015-08-21 13:43:18.000000000","message":"Maybe this is the bigger issue - that the nova database is considered the source of truth for the power state of the instance rather than the hypervisor.  I think PowerVC had actually modified this so that is turned around (kyleh on review would know the details), so the hypervisor is considered the source of truth for the instance and the state of the instance in nova is updated (either stopped, or I suppose started?).","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6a8e258ecb9aec0dcf645f14ec2f137abb7c9819","unresolved":false,"context_lines":[{"line_number":21,"context_line":"            decide the course of action"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_c6e895b5","line":24,"in_reply_to":"fa1b9901_23c38339","updated":"2015-08-21 13:55:38.000000000","message":"The assertion here doesn\u0027t seem to be correct though. I believe the assumption is that the power state is owned by the hypervisor, and all other states are owned by nova. Here is where we make the hypervisor the source of truth:\n\nhttps://github.com/openstack/nova/blob/master/nova/compute/manager.py#L5899","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ed4e5b81ff6be04379b788f5c6bd8bd7bbef6118","unresolved":false,"context_lines":[{"line_number":21,"context_line":"            decide the course of action"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_dadb8520","line":24,"in_reply_to":"fa1b9901_c6e895b5","updated":"2015-08-21 16:01:33.000000000","message":"Dan, the problem is one the next iteration when the periodic task decides to blow things away. That is, the hypervisor may be the single source of truth but the compute node decides to take proactive actions that cause deployment issues. I have explained these above and below a number of times. Basically an example is that when this runs the hyperviosr may think that the instance is down, for example, libvirt may return that there is an error with the instance due to a process being down, but that production VM is actually up and running, then on the second iteration the periodic tasks deletes the instance.\n\nSo a very simple situation:\na tenant sends a ping to the guest. this works. there is a clunky state on the hypervisor, and after a while the instance is deleted due to that.\n\nis this what you want? the reason that the bug was opened was that this happened in our labs and production vms went down.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3c62e4c683f207c080289297362f054f6c980315","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"},{"line_number":28,"context_line":"found another inconsistency which will shutdown the instance."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_23e4e3a9","line":25,"updated":"2015-08-21 13:43:18.000000000","message":"Is this a typo?\n\n\"if the hypervisor detects that the instance is down,\"\n\nIf the hypervisor says the instance is down but nova thinks it\u0027s ACTIVE, then nova will stop it to align the nova database with the hypervisor.\n\nI assume what you meant was the hypervisor thinks the instance is running but nova thinks it\u0027s stopped (because nova wasn\u0027t aware of it being restarted by the admin outside of nova manually), so then nova goes and stops the running instance.  This is the case that trips people up I think, because calling the stop API on an instance that isn\u0027t running is fine.  But stopping an actually running instance is potentially bad - and there have been a few bugs related to that with a race in the libvirt driver wrt lifecycle event handling after reboot (I can dig those changes up if you want a reference).","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6a8e258ecb9aec0dcf645f14ec2f137abb7c9819","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"},{"line_number":28,"context_line":"found another inconsistency which will shutdown the instance."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_c6365550","line":25,"in_reply_to":"fa1b9901_23e4e3a9","updated":"2015-08-21 13:55:38.000000000","message":"If the hypervisor reports that the instance is not running when it is, I don\u0027t think that nova taking action to make the DB match is wrong at all. The hypervisor should return an error or some other indeterminate thing if it isn\u0027t able to determine what state the vm is in. If we need to make nova tolerate the driver returning \"I don\u0027t know right now\" during this periodic, then we should to *that*.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d78d4c27a7f9f82ed99568edde14f859cdbc7827","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"},{"line_number":28,"context_line":"found another inconsistency which will shutdown the instance."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_e63919a5","line":25,"in_reply_to":"fa1b9901_23e4e3a9","updated":"2015-08-21 13:47:21.000000000","message":"The references for the reboot case are in here:\n\nd09785b97a282e8538642f6f8bcdd8491197ed74","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ed4e5b81ff6be04379b788f5c6bd8bd7bbef6118","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The method _sync_instance_power_state will always update the"},{"line_number":24,"context_line":"hypervisor state to the database base if they differ. In the worst"},{"line_number":25,"context_line":"case scenario, if the hypervisor detects that the instance is down,"},{"line_number":26,"context_line":"which may be due to an admin restarting it, an HA event on a"},{"line_number":27,"context_line":"clustered system etc., the next iteration of the periodic task will"},{"line_number":28,"context_line":"found another inconsistency which will shutdown the instance."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"fa1b9901_3a7de1b1","line":25,"in_reply_to":"fa1b9901_c6365550","updated":"2015-08-21 16:01:33.000000000","message":"dan, the reason why matt suggested the disabling of the periodic task is that this actually happens. The fact that he posted a patch to have a warning that the periodic task is disabled is also something that raises attention to this.\nthe fact that the perdioc task does things that the are problemtic is concerning.\nwhat this patch does is enable the periodc task to run and enables the admin to try and make those decisions, if necessARY.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"100f53aa5e9998cab02f4335c4aba43520c9c830","unresolved":false,"context_lines":[{"line_number":10,"context_line":"states between the database and the hypervisor. In some cases"},{"line_number":11,"context_line":"shutting down the instance problematic and that action may be"},{"line_number":12,"context_line":"something which the admin decides to do instead of having this"},{"line_number":13,"context_line":"done by the compute manager. That may lead to active instances"},{"line_number":14,"context_line":"being shutdown due to a legitimate outage on the driver backend."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"This patch enables the admin to decide on the action to be taken"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"da20952f_e2236e54","line":13,"updated":"2015-08-31 17:32:14.000000000","message":"You don\u0027t actually handle this case, as noted in the code.","commit_id":"c50cc5b4f81ba621f388d7a137b935e383248917"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"ac4f0d1115f17f53edaf04ce3018bbb9893f267b","unresolved":false,"context_lines":[{"line_number":11,"context_line":"shutting down the instance problematic and that action may be"},{"line_number":12,"context_line":"something which the admin decides to do instead of having this"},{"line_number":13,"context_line":"done by the compute manager. That may lead to active instances"},{"line_number":14,"context_line":"being shutdown due to a legitimate outage on the driver backend."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"This patch enables the admin to decide on the action to be taken"},{"line_number":17,"context_line":"in the event that the states are out of sync. There are two options:"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"da20952f_22dc0645","line":14,"updated":"2015-08-31 17:32:36.000000000","message":"This seems like where the fix should be.  If there is an outage on the driver backend then a legitimate power state should not be returned to be synced.  Signal an error at this point and skip the sync for that instance.  Why make this an admin choice?","commit_id":"c50cc5b4f81ba621f388d7a137b935e383248917"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"87c82920475dea9a239204b2b41104921b489701","unresolved":false,"context_lines":[{"line_number":11,"context_line":"shutting down the instance problematic and that action may be"},{"line_number":12,"context_line":"something which the admin decides to do instead of having this"},{"line_number":13,"context_line":"done by the compute manager. That may lead to active instances"},{"line_number":14,"context_line":"being shutdown due to a legitimate outage on the driver backend."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"This patch enables the admin to decide on the action to be taken"},{"line_number":17,"context_line":"in the event that the states are out of sync. There are two options:"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"da20952f_c52e748b","line":14,"in_reply_to":"da20952f_22dc0645","updated":"2015-08-31 17:49:44.000000000","message":"+1 - but garyk said VC doesn\u0027t know the state of the hosts in the cluster to determine that, just that the instance is down.  That sounds like a problem in VC...there really isn\u0027t a way to tell where the instance is running in the cluster that VC is managing?  Then how does VC know the instance is down?","commit_id":"c50cc5b4f81ba621f388d7a137b935e383248917"}],"nova/compute/manager.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"79320090350a694cd74133601a9b675f3a20bf26","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa32b979_6343c642","line":136,"updated":"2015-06-25 14:34:07.000000000","message":"You\u0027re not doing anything with the notify here.","commit_id":"f39dad06185e74ae5ee13ee48843fc3cf439a302"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"4264e5ef94f5dcec134f00747193c78231797a6c","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa32b979_c6d047fa","line":136,"in_reply_to":"fa32b979_6343c642","updated":"2015-06-28 11:23:42.000000000","message":"if we are using choices then if the user does not select \u0027stop\u0027 then they need another option.\ni will add in a log message below.","commit_id":"f39dad06185e74ae5ee13ee48843fc3cf439a302"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"c87f40ef19a91d2c2ed4623a202ecb1e952da1e4","unresolved":false,"context_lines":[{"line_number":5681,"context_line":"        If the instance is not found on the hypervisor, but is in the database,"},{"line_number":5682,"context_line":"        then a stop() API will be called on the instance."},{"line_number":5683,"context_line":"        \"\"\""},{"line_number":5684,"context_line":""},{"line_number":5685,"context_line":"        # We re-query the DB to get the latest instance info to minimize"},{"line_number":5686,"context_line":"        # (not eliminate) race condition."},{"line_number":5687,"context_line":"        db_instance.refresh(use_slave\u003duse_slave)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_fbc9a1ad","side":"PARENT","line":5684,"updated":"2015-06-29 12:10:06.000000000","message":"noop","commit_id":"6969f270c5035325c603ce7a98b1647b72bf5eaa"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"9ba0ce2f379dcc9fbc187a87f3bc4996bfca57d1","unresolved":false,"context_lines":[{"line_number":5681,"context_line":"        If the instance is not found on the hypervisor, but is in the database,"},{"line_number":5682,"context_line":"        then a stop() API will be called on the instance."},{"line_number":5683,"context_line":"        \"\"\""},{"line_number":5684,"context_line":""},{"line_number":5685,"context_line":"        # We re-query the DB to get the latest instance info to minimize"},{"line_number":5686,"context_line":"        # (not eliminate) race condition."},{"line_number":5687,"context_line":"        db_instance.refresh(use_slave\u003duse_slave)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_1fb1a68f","side":"PARENT","line":5684,"in_reply_to":"ba3cc151_fbc9a1ad","updated":"2015-06-30 08:28:06.000000000","message":"Done","commit_id":"6969f270c5035325c603ce7a98b1647b72bf5eaa"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"c87f40ef19a91d2c2ed4623a202ecb1e952da1e4","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_1b1485f3","line":136,"updated":"2015-06-29 12:10:06.000000000","message":"Instead of \"stop\" we probably want to find an other term since we can have a shutdown on the instance of an delete.\n\nWhat about \"auto\" ?","commit_id":"d215e9dba9e5d608dca3bfadf94519425099663a"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"9ba0ce2f379dcc9fbc187a87f3bc4996bfca57d1","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_5fd16ecc","line":136,"in_reply_to":"ba3cc151_1b1485f3","updated":"2015-06-30 08:28:06.000000000","message":"i do not think that auto here is relevant. we specifcally want to stop the instances.","commit_id":"d215e9dba9e5d608dca3bfadf94519425099663a"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"1844636a3b9a91da4f84014fba493fc32ad73b23","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba3cc151_6177f43a","line":136,"in_reply_to":"ba3cc151_5fd16ecc","updated":"2015-06-30 10:10:32.000000000","message":"But it seems that after reading the algo we can have a different behaviors, not only a stop.","commit_id":"d215e9dba9e5d608dca3bfadf94519425099663a"},{"author":{"_account_id":9172,"name":"Radoslav Gerganov","email":"rgerganov@vmware.com","username":"rgerganov"},"change_message_id":"924315a5d0127d0097eedaf2792121859d16d6e7","unresolved":false,"context_lines":[{"line_number":5788,"context_line":"                        vm_states.ERROR):"},{"line_number":5789,"context_line":"            # TODO(maoy): we ignore these vm_state for now."},{"line_number":5790,"context_line":"            pass"},{"line_number":5791,"context_line":"        elif vm_state \u003d\u003d vm_states.ACTIVE:"},{"line_number":5792,"context_line":"            # The only rational power state should be RUNNING"},{"line_number":5793,"context_line":"            if vm_power_state in (power_state.SHUTDOWN,"},{"line_number":5794,"context_line":"                                  power_state.CRASHED):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_1c8c3834","line":5791,"updated":"2015-07-21 11:10:09.000000000","message":"you can implement this with a single check:\n\nif vm_power_state !\u003d power_state.RUNNING and CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:\n    LOG.warning(_LI(\"Power state is not RUNNING for an active instance\")\n    return","commit_id":"a12ce61695b4c42772e8fc10f6fd67dddc7b51bc"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"975d44d15f44379407486e985397cc85f93ad1bc","unresolved":false,"context_lines":[{"line_number":5788,"context_line":"                        vm_states.ERROR):"},{"line_number":5789,"context_line":"            # TODO(maoy): we ignore these vm_state for now."},{"line_number":5790,"context_line":"            pass"},{"line_number":5791,"context_line":"        elif vm_state \u003d\u003d vm_states.ACTIVE:"},{"line_number":5792,"context_line":"            # The only rational power state should be RUNNING"},{"line_number":5793,"context_line":"            if vm_power_state in (power_state.SHUTDOWN,"},{"line_number":5794,"context_line":"                                  power_state.CRASHED):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_f2308ca0","line":5791,"in_reply_to":"3a50d1a3_1c8c3834","updated":"2015-07-21 13:35:40.000000000","message":"Done","commit_id":"a12ce61695b4c42772e8fc10f6fd67dddc7b51bc"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"074fcc73cc60df79875e0f17e5c48725f7bffe14","unresolved":false,"context_lines":[{"line_number":5862,"context_line":"                LOG.warning(_LW(\"Instance is suspended unexpectedly.\"),"},{"line_number":5863,"context_line":"                            instance\u003ddb_instance)"},{"line_number":5864,"context_line":"                if CONF.sync_power_state_action \u003d\u003d \u0027stop\u0027:"},{"line_number":5865,"context_line":"                    LOG.warning(_LW(\"Calling the stop API\"))"},{"line_number":5866,"context_line":"                    try:"},{"line_number":5867,"context_line":"                        self.compute_api.stop(context, db_instance)"},{"line_number":5868,"context_line":"                    except Exception:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_52aef281","line":5865,"updated":"2015-07-22 08:15:14.000000000","message":"maybe we can add instance\u003ddb_instance in this log?","commit_id":"e8ef3f95f1531d37a77dc25487b865d6a2a4b1e9"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6794b3dc35fc2807bcc6733bccdacef43fa336bd","unresolved":false,"context_lines":[{"line_number":5862,"context_line":"                LOG.warning(_LW(\"Instance is suspended unexpectedly.\"),"},{"line_number":5863,"context_line":"                            instance\u003ddb_instance)"},{"line_number":5864,"context_line":"                if CONF.sync_power_state_action \u003d\u003d \u0027stop\u0027:"},{"line_number":5865,"context_line":"                    LOG.warning(_LW(\"Calling the stop API\"))"},{"line_number":5866,"context_line":"                    try:"},{"line_number":5867,"context_line":"                        self.compute_api.stop(context, db_instance)"},{"line_number":5868,"context_line":"                    except Exception:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_1046e94e","line":5865,"in_reply_to":"3a50d1a3_52aef281","updated":"2015-07-23 05:05:40.000000000","message":"Done","commit_id":"e8ef3f95f1531d37a77dc25487b865d6a2a4b1e9"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"074fcc73cc60df79875e0f17e5c48725f7bffe14","unresolved":false,"context_lines":[{"line_number":5872,"context_line":"                elif CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:"},{"line_number":5873,"context_line":"                    LOG.info(_LI(\u0027Instance is not suspended. Current instance \u0027"},{"line_number":5874,"context_line":"                                 \u0027state is %s\u0027), vm_power_state,"},{"line_number":5875,"context_line":"                             instance\u003ddb_instance)"},{"line_number":5876,"context_line":"            elif vm_power_state \u003d\u003d power_state.PAUSED:"},{"line_number":5877,"context_line":"                # Note(maoy): a VM may get into the paused state not only"},{"line_number":5878,"context_line":"                # because the user request via API calls, but also"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_7201ae69","line":5875,"updated":"2015-07-22 08:15:14.000000000","message":"according to #5827, will these lines 5872-5875 be needless?","commit_id":"e8ef3f95f1531d37a77dc25487b865d6a2a4b1e9"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6794b3dc35fc2807bcc6733bccdacef43fa336bd","unresolved":false,"context_lines":[{"line_number":5872,"context_line":"                elif CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:"},{"line_number":5873,"context_line":"                    LOG.info(_LI(\u0027Instance is not suspended. Current instance \u0027"},{"line_number":5874,"context_line":"                                 \u0027state is %s\u0027), vm_power_state,"},{"line_number":5875,"context_line":"                             instance\u003ddb_instance)"},{"line_number":5876,"context_line":"            elif vm_power_state \u003d\u003d power_state.PAUSED:"},{"line_number":5877,"context_line":"                # Note(maoy): a VM may get into the paused state not only"},{"line_number":5878,"context_line":"                # because the user request via API calls, but also"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_706dedca","line":5875,"in_reply_to":"3a50d1a3_7201ae69","updated":"2015-07-23 05:05:40.000000000","message":"Done","commit_id":"e8ef3f95f1531d37a77dc25487b865d6a2a4b1e9"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ffe2a452daf99efcf4d3f96d3efe7e1d96f1d187","unresolved":false,"context_lines":[{"line_number":5826,"context_line":"        elif vm_state \u003d\u003d vm_states.ACTIVE:"},{"line_number":5827,"context_line":"            if (vm_power_state !\u003d power_state.RUNNING and"},{"line_number":5828,"context_line":"                    CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027):"},{"line_number":5829,"context_line":"                LOG.warning(_LW(\"Power state is not RUNNING for an active \""},{"line_number":5830,"context_line":"                                \"instance\"), instance\u003ddb_instance)"},{"line_number":5831,"context_line":"                return"},{"line_number":5832,"context_line":"            # The only rational power state should be RUNNING"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_66498930","line":5829,"updated":"2015-07-23 19:15:12.000000000","message":"Log the power_state.","commit_id":"9ebf53821e774bb76aaf6769b38e582792eb8f78"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6c03f230fcd520e9219edca074b4a4d0d3a9538e","unresolved":false,"context_lines":[{"line_number":5826,"context_line":"        elif vm_state \u003d\u003d vm_states.ACTIVE:"},{"line_number":5827,"context_line":"            if (vm_power_state !\u003d power_state.RUNNING and"},{"line_number":5828,"context_line":"                    CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027):"},{"line_number":5829,"context_line":"                LOG.warning(_LW(\"Power state is not RUNNING for an active \""},{"line_number":5830,"context_line":"                                \"instance\"), instance\u003ddb_instance)"},{"line_number":5831,"context_line":"                return"},{"line_number":5832,"context_line":"            # The only rational power state should be RUNNING"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_23e9ec1a","line":5829,"in_reply_to":"3a50d1a3_66498930","updated":"2015-07-25 07:20:46.000000000","message":"Done","commit_id":"9ebf53821e774bb76aaf6769b38e582792eb8f78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ffe2a452daf99efcf4d3f96d3efe7e1d96f1d187","unresolved":false,"context_lines":[{"line_number":5923,"context_line":"                                          \"sync_power_state.\"),"},{"line_number":5924,"context_line":"                                      instance\u003ddb_instance)"},{"line_number":5925,"context_line":"                elif CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:"},{"line_number":5926,"context_line":"                    LOG.info(_LI(\u0027Instance is not paused. Current instance \u0027"},{"line_number":5927,"context_line":"                                 \u0027state is %s\u0027), vm_power_state,"},{"line_number":5928,"context_line":"                             instance\u003ddb_instance)"},{"line_number":5929,"context_line":"        elif vm_state in (vm_states.SOFT_DELETED,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_a642310d","line":5926,"updated":"2015-07-23 19:15:12.000000000","message":"\"instance state\" is nebulous, use \u0027power state\u0027 instead.","commit_id":"9ebf53821e774bb76aaf6769b38e582792eb8f78"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6c03f230fcd520e9219edca074b4a4d0d3a9538e","unresolved":false,"context_lines":[{"line_number":5923,"context_line":"                                          \"sync_power_state.\"),"},{"line_number":5924,"context_line":"                                      instance\u003ddb_instance)"},{"line_number":5925,"context_line":"                elif CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:"},{"line_number":5926,"context_line":"                    LOG.info(_LI(\u0027Instance is not paused. Current instance \u0027"},{"line_number":5927,"context_line":"                                 \u0027state is %s\u0027), vm_power_state,"},{"line_number":5928,"context_line":"                             instance\u003ddb_instance)"},{"line_number":5929,"context_line":"        elif vm_state in (vm_states.SOFT_DELETED,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_43ec3829","line":5926,"in_reply_to":"3a50d1a3_a642310d","updated":"2015-07-25 07:20:46.000000000","message":"Done","commit_id":"9ebf53821e774bb76aaf6769b38e582792eb8f78"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"da653828af22905aaf5a4f9db5fb62f2086bac3c","unresolved":false,"context_lines":[{"line_number":5865,"context_line":"            elif vm_power_state \u003d\u003d power_state.SUSPENDED:"},{"line_number":5866,"context_line":"                LOG.warning(_LW(\"Instance is suspended unexpectedly.\"),"},{"line_number":5867,"context_line":"                            instance\u003ddb_instance)"},{"line_number":5868,"context_line":"                if CONF.sync_power_state_action \u003d\u003d \u0027stop\u0027:"},{"line_number":5869,"context_line":"                    LOG.warning(_LW(\"Calling the stop API\"),"},{"line_number":5870,"context_line":"                                instance\u003ddb_instance)"},{"line_number":5871,"context_line":"                    try:"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_2c5a03f3","line":5868,"updated":"2015-07-27 19:15:07.000000000","message":"Isn\u0027t this check unneeded since the only two CONF values are \u0027notify\u0027 and \u0027stop\u0027 and the \u0027notify\u0027 case would be caught by the if on line 5830 since the vm_power_state is suspended (i.e. !\u003d RUNNING.)","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"b4bf267958e926c3d519593241b9c7c4800d60b8","unresolved":false,"context_lines":[{"line_number":5865,"context_line":"            elif vm_power_state \u003d\u003d power_state.SUSPENDED:"},{"line_number":5866,"context_line":"                LOG.warning(_LW(\"Instance is suspended unexpectedly.\"),"},{"line_number":5867,"context_line":"                            instance\u003ddb_instance)"},{"line_number":5868,"context_line":"                if CONF.sync_power_state_action \u003d\u003d \u0027stop\u0027:"},{"line_number":5869,"context_line":"                    LOG.warning(_LW(\"Calling the stop API\"),"},{"line_number":5870,"context_line":"                                instance\u003ddb_instance)"},{"line_number":5871,"context_line":"                    try:"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_9aec08f5","line":5868,"in_reply_to":"3a50d1a3_2c5a03f3","updated":"2015-07-30 14:12:12.000000000","message":"good catch","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5ceb59f45d5f78f77667b93bcd2529076b676ff6","unresolved":false,"context_lines":[{"line_number":5908,"context_line":"                    # NOTE(russellb) Force the stop, because normally the"},{"line_number":5909,"context_line":"                    # compute API would not allow an attempt to stop a stopped"},{"line_number":5910,"context_line":"                    # instance."},{"line_number":5911,"context_line":"                    self.compute_api.force_stop(context, db_instance)"},{"line_number":5912,"context_line":"                except Exception:"},{"line_number":5913,"context_line":"                    LOG.exception(_LE(\"error during stop() in \""},{"line_number":5914,"context_line":"                                      \"sync_power_state.\"),"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_9461e3aa","line":5911,"updated":"2015-07-27 16:21:47.000000000","message":"You don\u0027t care about this case?","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"b4bf267958e926c3d519593241b9c7c4800d60b8","unresolved":false,"context_lines":[{"line_number":5908,"context_line":"                    # NOTE(russellb) Force the stop, because normally the"},{"line_number":5909,"context_line":"                    # compute API would not allow an attempt to stop a stopped"},{"line_number":5910,"context_line":"                    # instance."},{"line_number":5911,"context_line":"                    self.compute_api.force_stop(context, db_instance)"},{"line_number":5912,"context_line":"                except Exception:"},{"line_number":5913,"context_line":"                    LOG.exception(_LE(\"error during stop() in \""},{"line_number":5914,"context_line":"                                      \"sync_power_state.\"),"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_9aede8b9","line":5911,"in_reply_to":"3a50d1a3_9461e3aa","updated":"2015-07-30 14:12:12.000000000","message":"this is handled above in 5830","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"f435c409cc7c77a5dbea1e82e442adb79cf61495","unresolved":false,"context_lines":[{"line_number":5908,"context_line":"                    # NOTE(russellb) Force the stop, because normally the"},{"line_number":5909,"context_line":"                    # compute API would not allow an attempt to stop a stopped"},{"line_number":5910,"context_line":"                    # instance."},{"line_number":5911,"context_line":"                    self.compute_api.force_stop(context, db_instance)"},{"line_number":5912,"context_line":"                except Exception:"},{"line_number":5913,"context_line":"                    LOG.exception(_LE(\"error during stop() in \""},{"line_number":5914,"context_line":"                                      \"sync_power_state.\"),"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_1d078819","line":5911,"in_reply_to":"3a50d1a3_9aede8b9","updated":"2015-07-30 16:51:40.000000000","message":"How is it handled by 5830?  The precondition there is that vmstate\u003d\u003dACTIVE.  Here the precondition is vmstate\u003d\u003dSTOPPED.\n\nThis is really a different case isn\u0027t it (the opposite).  OpenStack thinks the VM should be stopped but it\u0027s really running, so we\u0027re stopping the VM to align the states.  I\u0027ve always considered this a weird solution to this case.  The other case, we\u0027re updating the state to reflect the actual power state of the VM (it\u0027s stopped) but in this case we take the action of actually stopping a running VM thus aligning the states.","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"62dc0bfab39fe8ada49cc3a704251fcfbdc5631a","unresolved":false,"context_lines":[{"line_number":5926,"context_line":"                        LOG.exception(_LE(\"error during stop() in \""},{"line_number":5927,"context_line":"                                          \"sync_power_state.\"),"},{"line_number":5928,"context_line":"                                      instance\u003ddb_instance)"},{"line_number":5929,"context_line":"                elif CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:"},{"line_number":5930,"context_line":"                    LOG.info(_LI(\u0027Instance is not paused. Current power \u0027"},{"line_number":5931,"context_line":"                                 \u0027state is %s\u0027), vm_power_state,"},{"line_number":5932,"context_line":"                             instance\u003ddb_instance)"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_31826101","line":5929,"updated":"2015-07-27 16:07:40.000000000","message":"Do we even need this?  The warning logged on line 5919 should be enough, unless you want to add the vm_power_state to that also.","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"b4bf267958e926c3d519593241b9c7c4800d60b8","unresolved":false,"context_lines":[{"line_number":5926,"context_line":"                        LOG.exception(_LE(\"error during stop() in \""},{"line_number":5927,"context_line":"                                          \"sync_power_state.\"),"},{"line_number":5928,"context_line":"                                      instance\u003ddb_instance)"},{"line_number":5929,"context_line":"                elif CONF.sync_power_state_action \u003d\u003d \u0027notify\u0027:"},{"line_number":5930,"context_line":"                    LOG.info(_LI(\u0027Instance is not paused. Current power \u0027"},{"line_number":5931,"context_line":"                                 \u0027state is %s\u0027), vm_power_state,"},{"line_number":5932,"context_line":"                             instance\u003ddb_instance)"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a50d1a3_3a2934f3","line":5929,"in_reply_to":"3a50d1a3_31826101","updated":"2015-07-30 14:12:12.000000000","message":"Done","commit_id":"5319e302f0ff65815e5e61b8a6707bea0ecc745f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc850b8c0a2b7a38e2746eeffdd17fe12493cd1e","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance. \"stop\" will stop the instances and \"notify\" \u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_432eb78c","line":136,"updated":"2015-08-21 13:28:21.000000000","message":"The notify option should be called log.  You\u0027re not emitting a notification, you\u0027re just logging.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ed4e5b81ff6be04379b788f5c6bd8bd7bbef6118","unresolved":false,"context_lines":[{"line_number":133,"context_line":"                    \u0027 allocation on failures\u0027),"},{"line_number":134,"context_line":"    cfg.StrOpt(\u0027sync_power_state_action\u0027,"},{"line_number":135,"context_line":"               default\u003d\u0027stop\u0027,"},{"line_number":136,"context_line":"               choices\u003d(\u0027stop\u0027, \u0027notify\u0027),"},{"line_number":137,"context_line":"               help\u003d\u0027The action to take when there is an inconsistency with \u0027"},{"line_number":138,"context_line":"                    \u0027the database instance state and the actual state of the \u0027"},{"line_number":139,"context_line":"                    \u0027instance. \"stop\" will stop the instances and \"notify\" \u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_5a5d3547","line":136,"in_reply_to":"fa1b9901_432eb78c","updated":"2015-08-21 16:01:33.000000000","message":"Done","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3c62e4c683f207c080289297362f054f6c980315","unresolved":false,"context_lines":[{"line_number":5857,"context_line":"                         \u0027DB to match the hypervisor.\u0027),"},{"line_number":5858,"context_line":"                     {\u0027db_power_state\u0027: db_power_state,"},{"line_number":5859,"context_line":"                      \u0027vm_power_state\u0027: vm_power_state},"},{"line_number":5860,"context_line":"                     instance\u003ddb_instance)"},{"line_number":5861,"context_line":"            # power_state is always updated from hypervisor to db"},{"line_number":5862,"context_line":"            db_instance.power_state \u003d vm_power_state"},{"line_number":5863,"context_line":"            db_instance.save()"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_03c2ffe8","line":5860,"updated":"2015-08-21 13:43:18.000000000","message":"Note that here we actually sync up the power_state in the nova database using what the hypervisor says it is.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ed4e5b81ff6be04379b788f5c6bd8bd7bbef6118","unresolved":false,"context_lines":[{"line_number":5857,"context_line":"                         \u0027DB to match the hypervisor.\u0027),"},{"line_number":5858,"context_line":"                     {\u0027db_power_state\u0027: db_power_state,"},{"line_number":5859,"context_line":"                      \u0027vm_power_state\u0027: vm_power_state},"},{"line_number":5860,"context_line":"                     instance\u003ddb_instance)"},{"line_number":5861,"context_line":"            # power_state is always updated from hypervisor to db"},{"line_number":5862,"context_line":"            db_instance.power_state \u003d vm_power_state"},{"line_number":5863,"context_line":"            db_instance.save()"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_ddce1fb7","line":5860,"in_reply_to":"fa1b9901_03c2ffe8","updated":"2015-08-21 16:01:33.000000000","message":"yes, that is correct - and this is where the issues occur as the periodic task uses this the next iteration and sees that there is a conflicting state with the hypervisor and this becomes the single source of truth - now on the next iteration the power state will be down and the hyperviosr says its up so nova shuts the instance down ....","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3c62e4c683f207c080289297362f054f6c980315","unresolved":false,"context_lines":[{"line_number":5936,"context_line":"        elif vm_state \u003d\u003d vm_states.STOPPED:"},{"line_number":5937,"context_line":"            if vm_power_state not in (power_state.NOSTATE,"},{"line_number":5938,"context_line":"                                      power_state.SHUTDOWN,"},{"line_number":5939,"context_line":"                                      power_state.CRASHED):"},{"line_number":5940,"context_line":"                LOG.warning(_LW(\"Instance is not stopped. Calling \""},{"line_number":5941,"context_line":"                                \"the stop API. Current vm_state: %(vm_state)s,\""},{"line_number":5942,"context_line":"                                \" current task_state: %(task_state)s, \""}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_4617a544","line":5939,"updated":"2015-08-21 13:43:18.000000000","message":"This is the only potentially bad case in this sync method in my opinion.  This is the case that the nova database says the instance is stopped but it\u0027s actually running on the hypervisor, and then nova stops it.  This is where I\u0027ve seen the race with reboot and the lifecycle event handler in the libvirt driver (which should be fixed now).\n\nAnd given this is the case where nova actually takes down a running instance, I\u0027d think this is the one you\u0027d want to focus on, but you don\u0027t have any changes in this method about logging rather than stopping the instance.","commit_id":"286ab3e90c514de9318ae314325607dae61a5d80"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"100f53aa5e9998cab02f4335c4aba43520c9c830","unresolved":false,"context_lines":[{"line_number":6000,"context_line":"                    # NOTE(russellb) Force the stop, because normally the"},{"line_number":6001,"context_line":"                    # compute API would not allow an attempt to stop a stopped"},{"line_number":6002,"context_line":"                    # instance."},{"line_number":6003,"context_line":"                    self.compute_api.force_stop(context, db_instance)"},{"line_number":6004,"context_line":"                except Exception:"},{"line_number":6005,"context_line":"                    LOG.exception(_LE(\"error during stop() in \""},{"line_number":6006,"context_line":"                                      \"sync_power_state.\"),"}],"source_content_type":"text/x-python","patch_set":12,"id":"da20952f_4211fa02","line":6003,"updated":"2015-08-31 17:32:14.000000000","message":"In my mind, this is still the worst thing that can happen in this method - the nova database says the instance is stopped by the hypervisor says it\u0027s not, and we decide to shut it down.  You don\u0027t handle this case which in my mind is about the only one I\u0027d be interested in handling since it actually stops your running instances.\n\nIn the other cases I don\u0027t see them as big a deal since the hypervisor says the instance is stopped so we\u0027re just syncing up the nova database with the hypervisor in those other cases.","commit_id":"c50cc5b4f81ba621f388d7a137b935e383248917"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"01b12d1930362613069b8771374eb20cc9f1cc33","unresolved":false,"context_lines":[{"line_number":6000,"context_line":"                    # NOTE(russellb) Force the stop, because normally the"},{"line_number":6001,"context_line":"                    # compute API would not allow an attempt to stop a stopped"},{"line_number":6002,"context_line":"                    # instance."},{"line_number":6003,"context_line":"                    self.compute_api.force_stop(context, db_instance)"},{"line_number":6004,"context_line":"                except Exception:"},{"line_number":6005,"context_line":"                    LOG.exception(_LE(\"error during stop() in \""},{"line_number":6006,"context_line":"                                      \"sync_power_state.\"),"}],"source_content_type":"text/x-python","patch_set":12,"id":"da20952f_a51fc0b5","line":6003,"in_reply_to":"da20952f_4211fa02","updated":"2015-08-31 18:02:10.000000000","message":"If anything, I\u0027d consider a change just for this case where the nova db says the instance is stopped but the hypervisor says it\u0027s running and if resume_guests_state_on_host_boot\u003dTrue we reboot the instance to sync up the states between nova and the hypervisor rather than just stopping the instance (when the hypervisor says it\u0027s running).","commit_id":"c50cc5b4f81ba621f388d7a137b935e383248917"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"21d83aa596265172423a35731462ce28153983c6","unresolved":false,"context_lines":[{"line_number":6000,"context_line":"                    # NOTE(russellb) Force the stop, because normally the"},{"line_number":6001,"context_line":"                    # compute API would not allow an attempt to stop a stopped"},{"line_number":6002,"context_line":"                    # instance."},{"line_number":6003,"context_line":"                    self.compute_api.force_stop(context, db_instance)"},{"line_number":6004,"context_line":"                except Exception:"},{"line_number":6005,"context_line":"                    LOG.exception(_LE(\"error during stop() in \""},{"line_number":6006,"context_line":"                                      \"sync_power_state.\"),"}],"source_content_type":"text/x-python","patch_set":12,"id":"da20952f_88bc11bc","line":6003,"in_reply_to":"da20952f_a51fc0b5","updated":"2015-08-31 18:19:35.000000000","message":"Here is a potential alternative solution:\n\nhttps://review.openstack.org/#/c/218975/","commit_id":"c50cc5b4f81ba621f388d7a137b935e383248917"}]}
