Disable rescheduling instance when no retry info

When scheduler_max_attempts=1 means disable rescheduling, compute
won't reschedule instance before. But build_and_run_instance didn't
hornor this behavior. And cause nova reschedule instance infinitely.
This patch fix this problem, make build_and_run_instance won't reschedule
instance without retry info.

Change-Id: I52d6569c1731b5fd5a10f39ff04a40b43d3857a1
Partial-Bug: #1326207
Sync revert and finish resize on instance.uuid

We need to make sure we sync the state of the instance the same way we
do for do_confirm_resize. Previously, we were not syncing the instance
on revert or finish resize. We do this so that we can update the
migration and instance resize update orders. Previously if you set
resize_confirm_window to some small value, your resized instance could
go into error state because the periodic task was run after the
migration was updated but before the instance object was updated. This
change makes it so the instance is always updated before the migration.

Change-Id: Iaad1a05864b2b46180cadf16198b0fd8583c6703
Closes-Bug: 1326778
Fix the rest of direct uses of instance module objects

This switches the remaining occurences of
nova.objects.instance.Instance* to nova.objects.Instance*.

Partial-Blueprint: object-subclassing

Change-Id: I3017c149cc9fbc6b1fbecb003dc55455b1dcd12c
Fix object code direct use of other object modules

The object code itself should not explicitly reference its own objects,
as objects could be subclassed.

Also: There were a few objects that had their own __init__()s that
didn't support accepting 'context' or kwargs. At some point here, we
should also require that context is passed when instantiating the
objects. So, I added the (currently optional) context argument on some
object instantiations near the places I was touching.

Partial-Blueprint: object-subclassing

Change-Id: Icf631c770e347b4bb32999c4ba2431d1db49e11c
Updated from global requirements

Closes-Bug: #1333410

Change-Id: I49d5ee76ef8aed2cbbeec0377c119d3feeea4eca
Make Evacuate API use Instance objects.

Replace current instance dicts and conversions to Instance Objects.
Add services arg to create_fake_instance_obj.

Change-Id: I7ddf11ce17df254a8253461e17b5c6519cb7d6fe
Related to blueprint compute-manager-objects-juno
VMware: refactor get_datastore_ref_and_name

Update vm_util.get_datastore_ref_and_name to use Datastore class,
renamed it to get_datastore, remove vm_util.DSRecord along the way.

partial blueprint vmware-spawn-refactor

Change-Id: Ib3308870c09344036c4f330a48513581f5771246
Fix update agent return agent_id with string for os-agents v3

Currently the agent update return agent_id with integer, that is
inconsistent with the response of agent create and index. It because
agent update use the agent_id that passed from url as the response.
This problem is fixed by converting the agent id as integer.

And the API sample tests provide agent_id with string type in the fake
data. This patch fix this problem for API sample files and tests.

And for back-compatibility, we should add translator for v2.1 API later.
Then this fix will be exposed after v3 API feature exposed by microversion
in the future.

DocImpact: The agent_is is changed to integer type for agents'update action.

Change-Id: Ia9c1034a325b77a2057934cc80b6eab679ff1d2b
Partial-Bug: #1333494
Merge "Sync revert and finish resize on instance.uuid"
Merge "VMware: refactor get_datastore_ref_and_name"
Merge "Fix the rest of direct uses of instance module objects"
Merge "Fix object code direct use of other object modules"
Merge "Make Evacuate API use Instance objects."
Merge "Updated from global requirements"
Merge "Fix update agent return agent_id with string for os-agents v3"
Merge "Disable rescheduling instance when no retry info"