VMware: Network fallback in case specified one not found

In the case that opqaue network does not match the bridge ID then
we will fall back on a predefined network (configurable by the admin
via 'integration_bridge' in the 'vmware' section).

Fixes bug 1225002

(cherry picked from commit a0546fd3f42c37e8cd6e4e9b70d59ae1e689b4b7)

Change-Id: I7508a13f116b539fef1f771fc5ab4c32ffa520bc
Fix the wrong params of attach/detach interface for compute driver

The reason of attach_interface failed is current code passing VIF object
to attach_interface, but it expected NetworkInfo object. And as the
comment of attach/detach_interface, they should only accept one
interface to instance. So correct the interface signature only accept
an VIF object. And correct the fake driver behavior, make the test running
correctly.

Change-Id: Id0d28c39fb543853bd710fcb3c3b611306b4fb8f
Close-bug: #1233504
(cherry picked from commit 67414604a033413dc952c1909384340856ff9eb1)
fallocate image only when user has write access

Libvirt will change instance's ownership when the instance became power
off which will make nova-compute service unable to hard reboot instance
bacause the nova-compute service has not write access. This commit will
allocate space for image only the first time we create image.

fixes bug 1200113

Change-Id: Id81b09ade5f870665f5ffabab3cde144c6dec210
(cherry picked from commit c246fb37e20197be27264a36515725233085df1d)
Fix filter_properties of unshelve API

When unshelving a shelved server, nova-scheduler fails because nova-conductor
of current unshelve feature passes an empty list as filter_properties, and
nova-scheduler handles it as a dict.

To fix the problem, this patch changes the filter_properties to an empty dict.

Closes-Bug: #1233563

Change-Id: I2c7a2a743a8142af0be0a182067f3295980aa997
(cherry picked from commit ef3fbe99af498a40555b44f9ef0fcf6b88eb5d30)
Baremetal: Be more patient with IPMI and BMC

Before we called 'power status; power on' in a loop which made the
IPMI/BMCs not behave well.  Also the total time we would wait (2.5
seconds wasn't always enough).  So make sure power on/off is only called
once and wait up to 10 seconds for the power state change to go into
effect.

This patch has been tested on real baremetal using
https://wiki.openstack.org/wiki/TripleO/TripleOCloud

This bug is also linked to ironic so the change will be made there as
well.

Change-Id: I5a4d7c84ebdf9c1f7d8d0570dbc31764c31f1fc6
Closes-Bug: #1234479
(cherry picked from commit 6e30bbc126a1ad4eb87e735c812832f4fcc0054e)
XenAPI: Add versioning for plugins

Because the plugins live on a host seperate to Nova we need an interface
to test whether they are the expected version.  We can't use pip or other
requirement systems as they are cross-machine.

Closes bug 1226622

Change-Id: I58ab669061f51bd87071e2cf0d93d33021001309
(cherry picked from commit 24fd331b8cd5aca66362e6f76deec9c437875933)
Adds missing entry in setup.cfg for V3 API shelve plugin

Adds the missing entry in setup.cfg which allows the V3 API
shelve plugin to be loaded. Also adds a v3 version of the unittests
for the shelve plugin.

Change-Id: I737ca0cae503b726b0103a4ae169ffca91188c87
Closes-Bug: #1233454
(cherry picked from commit 96895e29b1a1387c185fe740021bb636aa02709f)
Correct use of ConfigFilesNotFoundError

ConfigFilesNotFoundError.__init__() takes "config_files", not
"path". And pass the config value itself rather than the result
of find_file(), which is always None.

Change-Id: Ia5285d252d5636892c4fbeb9191a6c7ed4923b78
Closes-Bug: 1236176
(cherry picked from commit 84b02ca1d54fd058c68345068832e84d2f80b9a5)
Add boto special casing for param changes in 2.14

boto 2.14 has some interface changes with the get_http_connection
call which adds port as a non optional parameter *in the middle of*
existing non optional parameters. It's a special kind of incompatible
change.

We are already special casing around boto in the unit tests, lets
just do more of that if we are running on a newer version.

(cherry picked from commit 1ce493b9e4e0c381146287161ab2a3c75f1fc603)

Co-Authored-By: Dan Smith <dansmith@redhat.com>
Closes-bug: #1237944
Change-Id: If388d872286eca15bf24a582db1bac22224a8b24
Sync three-part RPC versions support from Oslo

Change-Id: Ia93e7a6d978374e0dcf49c2be230c67e41a7bd14
(cherry picked from commit 337a722ce3e7c4c96c0b1f75bbd88c0ecced809b)
Merge "Baremetal: Be more patient with IPMI and BMC" into milestone-proposed
Merge "Adds missing entry in setup.cfg for V3 API shelve plugin" into milestone-proposed
Merge "XenAPI: Add versioning for plugins" into milestone-proposed
Merge "Fix the wrong params of attach/detach interface for compute driver" into milestone-proposed
Merge "Fix filter_properties of unshelve API" into milestone-proposed
Merge "fallocate image only when user has write access" into milestone-proposed
Merge "VMware: Network fallback in case specified one not found" into milestone-proposed
Avoid spamming conductor logs with object exceptions

Conductor's logs should include tracebacks only when something
unexpected happened, which is why we have the client_exceptions()
decorator. The object_action() and object_class_action() methods
are used for direct remoting of object methods, and thus really
should forward *any* exception to the client.

This patch does that, and also adds missing tests for these two
methods to verify the normal and exception-wrapped behavior.

Closes-bug: #1233789
Closes-bug: #1084706
Change-Id: I505462fa429a6aa68e7b8a08ec2b704bf18d029c
(cherry picked from commit 3a5e1faee04671f2e88b28d805b191b480054254)
Fix conductor's object change detection

Conductor was doing a copy.copy() on the inbound object to later
detect changes that should be sent back to the caller. This does not
copy things like Instance.system_metadata and thus is incapable of
properly detecting changes that should be tracked.

This patch makes conductor use obj_clone(), and imports Chris
Behrens' __deepcopy__ fix for objects so that deepcopy works.

Closes-bug: #1237102
Change-Id: I46ae8b0694dc31a90c1a5cdf76757d877877f072
(cherry picked from commit 73b3bf91df00059c69dc1dd81e4554ec24c647b1)
Merge "Correct use of ConfigFilesNotFoundError" into milestone-proposed