Comment 5 for bug 1320628

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/103174
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cc5388bbe81aba635fb757e202d860aeed98f3e8
Submitter: Jenkins
Branch: master

commit cc5388bbe81aba635fb757e202d860aeed98f3e8
Author: melanie witt <email address hidden>
Date: Fri Jun 27 15:45:15 2014 +0000

    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