Make test_evacuate from compute API DRYer

test_evacute creates a context in almost every test
and sets its properties. Move that to a method to avoid extra
copy/paste.

Change-Id: Ib75575061bddf2546c46a6ef788ab85b5926ce69
Fix monkey_patch docstring bug

Modify Flags.monkey_patch to CONF.monkey_patch

Change-Id: I773a94d97d206bf78ac52de8e22d9e6db7650eb9
Closes-Bug: #1258048
XenAPI: Allow use of clone_vdi on all SR types

All XenServer SR types support VDI.clone - even if they perform
an internal VDI.copy.  Always use the clone function if COW is
enabled.

Change-Id: I85c580fba43d3bb52149626419d0f0c03ed69145
Rename instance_type to flavor in vmware virt driver tests

Renames 'instance_type' to 'flavor' in the vmware virt driver tests.
There were no occurrences of 'instance_type' in the virt driver itself,
so this patch only changes the tests.

Part of blueprint flavor-instance-type-dedup

Change-Id: I81ea543e0ab480e35cf5b7b59bd9ecb1cf361c6f
Rename instance_type to flavor in libvirt virt driver tests

Renames 'instance_type' to 'flavor' in the libvirt virt driver tests.
There were no occurrences of 'instance_type' in the virt driver itself,
so this patch only changes the tests.

This also removes the unused _create_instance_type method in
test_libvirt.

Note that instance_type_id and instance_type_swap are not changed since
those are part of the database model and would require a database
migration to change them.

Part of blueprint flavor-instance-type-dedup

Change-Id: Iec71509e38aed1341f37194fb94dd34b10ac2f54
VMware: fix rescue with disks are not hot-addable

Some disks, for example IDE, cannot be attached to an instance
when the instance is running.

Change-Id: I3360066ea6406564caa328ec052b9e3ca9d63dc6
Closes-Bug: #1247556
Set objects indirection API in network service

We need to set the
nova.objects.baseNovaObject.indirection_api global inside the network
service to point to the conductor API so that the object actions will
 be done by RPC to conductor.

Part of blueprint: nova-network-objects

Change-Id: I9e2c643eae7d09f5037485386e6ea53b75587980
Add VirtualInterface object

Add new objects: VirtualInterface and VirtualInterfaceList.  These are
needed for converting nova-network over to use objects.

Part of blueprint nova-network-objects

Change-Id: Idab38a2a9bd8737fcc8e112759c539b7ebad4df9
Add host and details column to instance_actions_events table

Instance action event could be a useful tool to understand and trouble
shooting the scene after invoking an API request (action) for an
instance.

This change extends the action event model by adding additional two
columns to record on which host this event took place and more detail
message for a specific event.

Implements: blueprint improve-instance-action-events
Change-Id: Id209cd7b8a3a41f86cb802d4dd681443d5717bd0
Sync module units from oslo

Module units landed in Nova first, then was accepted by oslo with
minor changes. This patch removes nova specific unit module and
test, replaces with module units in oslo.

commit in Oslo:'Add unit constants' f9308560c36918cc

Change-Id: I6054c18a56f59d33a69f4714be19d34fbe9de335
Co-Authored-By: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
Nova Docker driver must remove network namespace

The docker hypervisor creates for each container a network
namespace which represents the nova network. This network
namespace must be removed/destroyed when nova instance will
be destroyed in order to cleanup the machine properly.

Change-Id: I6fa306d06fb16f8ceddb06e22566974237082759
Closes-Bug: 1261007
Add instance faults during live_migrate errors

When there is an error in the compute manager relating to
live-migrate, this change ensures that an instance fault is
recorded to help debug any issues.

We also need to look at better reporting of errors to users,
but this is not in the scope of this small change.

Change-Id: Ib4f0d0aea64468a4a1495b0318fc531a7d0d4eaa
Make test_different_fname_concurrency less racy

This test case makes a bad assumption about when a greenthread will run
and signal its done event.  The test code yields once using a sleep and
expects that the done event will get signaled before the test code runs
again.  This may not be the case.  Instead, yield up to 10 times waiting
for the done event to occur.

I was not able to reproduce this failure locally, but we're seeing it
regularly in CI.  It seems that this should resolve it.

Change-Id: I978ae9eef5bb1ac296055dc1613406e4284a625f
Closes-bug: #1270654
Hide VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES where needed

Running unit test against a newer libvirt fails due to
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES being always available.

This was mostly hidden as the old unit test globally deleted
the attribute during execution. Removing this side effect
and use mocking of attributes instead where needed.

Related-Bug: LP #1266534

Change-Id: Id0e6d8771f1a43f402b6323f0c0df38ee23e0fa8
Fix docstring in libvirt.driver.LibvirtDriver.get_instance_disk_info()

Update param list to match reality and fold in pre-existing
NOTEs about the parameters into the doc string.

Change-Id: I994f75ef4d0f1540c007ec1d430c6973e9308e35
Move fake_network config option to linux_net

Option 'fake_network' is used by nova/network/linux_net.py but not
imported from nova/network/manager.py. Both use it, but manager imports
linux_net (via nova/network/api.py + nova/network/floating_ips.py) so it
makes more sense to define the option in linux_net and import_opt in
manager.

Precise example import chain:
    bin/nova-manage
    nova/cmd/manage.py: import_opt('flat_network_bridge', 'nova.network.manager')
    nova/network/manager.py: from nova.network import api as network_api
      -- At this point, manager has started to import but not yet called
      register_opts
    nova/network/api.py: from nova.network import floating_ips
    nova/nova/network/floating_ips.py: import_opt('public_interface', 'nova.network.linux_net')
    nova/nova/network/linux_net.py: import_opt('fake_network', 'nova.network.manager')
      -- BANG! Manager hasn't registered the option we want to import

Change-Id: I66f021b34aef650dca148a58203c249f6aa0e83e
Create common method for MTU treatment

MTU setting for device was repeated a number of times in the code.
The patch set creates a common function to do this operation.

Change-Id: I5aea4eb02302d7396ae104bee906bf1c37239542
Sync processutils from oslo-incubator

This includes the following changes:

  af41592 Catch OSError in processutils
  f773ea2 Fix i18n problem in processutils module
  8b2b0b7 Use hacking import_exceptions for gettextutils._
  3b71f46 Fixed misspellings of common words
  12bcdb7 Remove vim header
  a4dab73 Correct execute() to check 0 in check_exit_code

Closes-bug: #1271331
Change-Id: I12b621fa5a2cdeeab6d51902416ce5dd4db61ba7
Re-write sqlite BigInteger mapping test

This test makes sure that our hook that compiles BigInteger() into
INTEGER for sqlite instead of BIGINT is working as we expect.
Unfortunately, we've seen some problems running the sqlite command to
check the schema.

This patch rewrites the test to only use sqlalchemy APIs and avoid
calling out to the sqlite command for verification.

Change-Id: Id3964d0dd5b0ddf08ab745d6878840ff06b2f0dd
Closes-bug: #1271331
Make test_poll_volume_usage_with_data more reliable

This test includes 2 calls to time.time().  It assumes that the result
from the second call may be greater than the first.  This isn't
definietly true and we see periodic failures of this test in the gate as
a result.

Change the test to not worry about the specific time value that gets
set.  We set _last_vol_usage_poll to 0 before calling the function under
test.  We really only need to check that it got set to some value after
calling the function under test.  This tweak should make the test pass
consistently.

Change-Id: I6c01d2958cf671c29622562689a15ca1ddea0a3c
Closes-bug: #1270693