Updated openstack/openstack
Project: openstack/nova  0da88cd575c09af12b4b8e0744218354e2105c26

synchronize 'stop' and power state periodic task

This change adds the synchronized decorator to the stop function and
_sync_instance_power_state to address a race condition when powering
off and updating the database for an instance. The power off and
database update should be protected so the periodic task sees a
consistent view when it checks power state from the driver and
VM state from the database in order to take action.

In the bug, a stopped instance is in the middle of being rebuilt,
and while it is in the process of being returned to the original
STOPPED state, _sync_power_states sees the combination of the
power state from the driver being 'on' and the vm_state from
the database as being STOPPED. This patch aims to ensure power
'off' and vm_state set to STOPPED happen atomically in the
stop_instance function. Thus, the read by _sync_power_states
must also be synced on the instance UUID.

Change-Id: I8aa83ab8dca35878cf792ae2d46feaa9912ffd38
Closes-Bug: #1320628