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
libvirt: fix typo in fakelibvirt listAllDomains()

It looks like this code isn't used in the tests at all since we replace
it with a fake in the list_instance_domains() tests ... so what's the
point of it?

We could also add tests for the function in test_fakelibvirt, but that
feels rather pointless too?

Change-Id: I8fa5301ad86e2eb117f40d26a7cfe7b9d86c873a
Merge "synchronize 'stop' and power state periodic task"
Merge "libvirt: fix typo in fakelibvirt listAllDomains()"