It seems the problem is a race with _sync_instance_power_state.
In rebuild_instance, after the rebuild is finished, if the original vm_state was STOPPED, it sets task_state to POWERING_OFF and calls stop_instance.
In the nova-compute log I see the message from _sync_instance_power_state, "Instance is not stopped. Calling the stop API." [1] It observed vm_state STOPPED and power state not off from the driver, and called compute api force_stop [2] which sets task_state to POWERING_OFF again and stops it again.
It seems the problem is a race with _sync_instance_ power_state.
In rebuild_instance, after the rebuild is finished, if the original vm_state was STOPPED, it sets task_state to POWERING_OFF and calls stop_instance.
In the nova-compute log I see the message from _sync_instance_ power_state, "Instance is not stopped. Calling the stop API." [1] It observed vm_state STOPPED and power state not off from the driver, and called compute api force_stop [2] which sets task_state to POWERING_OFF again and stops it again.
[1] http:// logs.openstack. org/52/ 73152/8/ check/check- tempest- dsvm-full/ 9352c04/ logs/screen- n-cpu.txt. gz?level= DEBUG#_ 2014-05- 13_18_09_ 11_515