Fix error in rescue rpcapi that prevents sending objects

The change restores the rescue_instance rpc's ability to send
instance objects from version 3.11 onwards, that was inadvertently
broken by https://review.openstack.org/#/c/62314

Unit test modified to check that rpc version passes instance object
instead of dict.

Change-Id: Icffea82da623d3aab4661554b33bd5959bfe2bd8
Closes-Bug: #1327145
libvirt: remove hack from ensure_filtering_rules_for_instance

The ensure_filtering_rules_for_instance method had a hack
where the test suite caller could pass in a module to
replace the greenthread.sleep call. This is utterly crazy
when mock can trivially replace the greenthread.sleep call
directly.

Partial-bug: #1333219
Change-Id: I449290aa366f5c85cc63a15d0b1704339be4d73a
Pass instance to _set_instance_error_state

This builds on commit 77a8478 so that _error_out_instance_on_exception
can pass the instance to _set_instance_error_state.  The next change in
the series will pass the instance down to _instance_update so if we have
an instance object we can avoid the direct call to conductor for state
changes and just update the instance object directly, which allows us to
remove instance.refresh() in the tests to pick up out-of-band database
updates on instance objects.

Part of blueprint compute-manager-objects-juno

Change-Id: I0a4607d368d3c226ca5a60d017d27c199c0dfe89
Add __repr__ handler for NovaObjects

This adds a __repr__ implementation for the base NovaObject which
should help debugging by compactly describing the contents of an
object. This adds stringification helpers to the Field object(s),
which lets us control what each type looks in compact format. Since
this is just for debugging, we avoid recursing too deeply on nested
objects and the like.

Change-Id: Ic604acfda7e7c7adb913479355726e16ad375f1d
Sync process utils from olso

This change syncs in:

33afb20 Fix broken formatting of processutils.execute log statement
5e3d3a5 Mask passwords included without quotes at the ends of commands
6751b30 Remove extra whitespace

The most important part is '33afb20' which was broken in nova after
the last oslo sync.

Change-Id: I669e283992347328d602b5a330fde9d1981d22f2
Move the instance_type_id judgment to the except-block

If the instance types are not stashed, will fallback to the
conductor API to retrieve them. So the instance_type_id is
only used in except-block.

Change-Id: If45eb01dd8292e87eda6516cd79c94fb7f6005fb
Merge "libvirt: remove hack from ensure_filtering_rules_for_instance"
Avoid referencing stale instance/network_info dicts in firewall

This makes the virt.firewall code cleaner in terms of referencing
the cached instance and network_info code it stores. Before this
patch, concurrent instance operations could modify these two dicts
so that while we're iterating instances, the network_info dict
is suddenly missing information we need.

The right fix for this is to use instance objects and their
associated info_cache objects, but that's a larger fix and one
not as well-suited to backporting to previous releases which
suffer from this as well.

The approach taken here is that we store the instance and
network_info cache together in the same dict that we can pop()
from atomically (this is not really necessary, but helps to
prevent introducing more of these cases). When we iterate over
the contents, we iterate over a copy of the keys, being careful
not to let a suddenly-missing key break us, and passing the
details all the way down the stack instead of having deeper calls
hit the cache dicts again.

Change-Id: I33366f50024a82451842d045b830ab19b59879c3
Closes-bug: #1182131
Merge "Fix error in rescue rpcapi that prevents sending objects"
Merge "Add __repr__ handler for NovaObjects"
Merge "Move the instance_type_id judgment to the except-block"
Merge "Avoid referencing stale instance/network_info dicts in firewall"
Merge "Pass instance to _set_instance_error_state"
Merge "Sync process utils from olso"