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
Add Agent object

This adds an object interface for the AgentBuild entity we store
in the database.

Related to blueprint compute-manager-objects-juno
Related to blueprint virt-objects-juno

Change-Id: Idf9b4f025d234dce5bbc8f728b5e0900cf9e1e42
Object-ify xenapi driver's use of agent_build_get_by_triple()

This makes the xenapi driver use the new Agent object instead of
making a VirtAPI/conductor raw call back to the database.

Related to blueprint virt-objects-juno

Change-Id: I8498c6f3e2fa5d614ac301402d2be778e5edb74e
Deprecate and remove agent_build_get_by_triple()

This method was only used in the xenapi driver, which has since been
converted to use Objects. This removes the call from VirtAPI, the
conductor API, and deprecates it from conductor manager.

Related to blueprint compute-manager-objects-juno

Change-Id: I43b8c4bc201361ce79d56cac91a8944d18c03ab2
Use default rpc_response_timeout in unit tests

During running of tox the system can timeout on slower systems.
We have seen this occur in our internal tests and have seen
better results when we increased the api timeout from 15 to 60
seconds.  This can be used until faster hardware is availale
or a better fix is proposed.  Andrew Laski first proposed
this fix.

Closes-Bug: 1311778

Change-Id: I33da328e7bea8fbdde3f01ee0147b4c5a3a278d2
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
Merge "Use default rpc_response_timeout in unit tests"
Merge "Add Agent object"
Merge "Object-ify xenapi driver's use of agent_build_get_by_triple()"
Merge "Deprecate and remove agent_build_get_by_triple()"
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
Xen: Remove extraneous logging of type information

There doesn't appear to be any value in logging the type of vdi_rec
after its value has just been logged.  It's just adding noise to the
logs.

Change-Id: Ia5ccc634375d9a4fa4783487908cb4f91f435a68
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"