Make sync_power_states yield

The sync_power_states periodic task can run for a long time, so it needs
to yield to other greenthreads. Adding yielding increases the chances
for race conditions, however.

So for every node returned from get_nodeinfo_list, we re-fetch and check
the states again, because they may have changed. Also, check the states
yet again after acquiring a lock. This can be fixed at some point by
allowing constraints to be passed when acquiring a lock. I've noted
this with a FIXME.

Also, when querying the Node, use the integer ID instead of the UUID,
because it's slightly more efficient.

Change-Id: Ie4d3f896e32b58378bfeb5ff457a9bfe6a8d065f
Merge "Make sync_power_states yield"