Nova network needs to take care of existing alias

Nova network should take care of existing aliases on bridge
interfaces when it adds address on top of the list.

Change-Id: Ife54c9eba64906406f7c44a66b596f3162ad16b6
Fixes: bug #1077066
Push 'Error' result from event to instance action.

Currently a failed event stores an 'Error' result but in order to see
which actions have failed it would require grabbing each one through the
api to see the events.  This patch adds 'Error' to the message field of
the instance action so that any actions with failures can be seen from
the initial listing of actions on an instance.

Change-Id: Ieeb798c47211ab00fe5b767dc1f18a665549ba01
sync oslo log updates

this helps address the issue where syslog gets overloaded and we
loose the ability to figure out what's going on in clients like
nova-manage

Change-Id: Iedde5ed4e8e23e204be4fa7a19e9514acf2ebf86
Standardize the coverage initializations.

Now when we measure coverage repeatedly, the coverage data of
nova-api is accumulated but the ones of other nova services are
reset each time.
This is due to create new "coverage" class each time
"_start_coverage_telnet" method is executed.

This patch limits creating "coverage" class the first time
the method is executed.

Fixes bug 1122720

Change-Id: Ia900c96113bee65362ccb7c4c1975535d814d835
Run libguestfs API calls in a thread pool

The libguestfs API is a binding to a native C library, and thus
it will block greenthreads. To avoid this all libguestfs API
calls need to be run in a threadpool. This can be done by just
wrapping the GuestFS object in an eventlet.tpool.Proxy object

Fixes bug #1132742
Change-Id: I877ad9e88442e41c9ad234503d9b1ddf1fb27408
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Remove unused nova.db.api:instance_get_all_by_reservation

Change-Id: I55192773eaa18eb81ffb2b5ec3567b09116b0d1e
Rework instance actions to work with cells

In a cells setup an instance action is recorded at the global cell level
while events try to get recorded in a child cell compute node or
scheduler.  The event recording fails because it can't find an action to
link to.  This patch adds the recording of actions at the child cell
level, and changes the API extension to query the db in a child cell for
the record of actions and events.

This does not address the fact that an action is recorded at the global
cell level.

Bug 1132935
Change-Id: I5831f146397e7afa2d93d26c5d6f9abb9bc6670d
Unpin routes dependency version

Fixes bug #1133258

It looks like we should be fine with 1.13 and have no reason to expect
future versions will break us.

Cinder and Quantum both require >=1.12.3 too.

Change-Id: Ice0649d98e2a46505503072c07509fe274f195b6
Unpin PasteDeploy dependency version

Fixes bug #1133262

There are no newer releases of PasteDeploy than 1.5.0 and we have no
reason to believe newer versions will break us. Indeed, if an
incompatible version is released, we will want to know about it quickly.

Change-Id: I331b33b16ea50202886b19bf5c4060d9fa46d5ec
Fix crash in quantumapi if no network or port id is specified

The existing code assumes that if no port id or fixed ip was specified,
that the network id passed in is valid. This is not necessarily the case,
and results in adding None to the list of network ids, which later
causes a check to see if the network id list is empty to fail.

This only adds the network id to the list if it was specified, and
adds a more explicit check to the region that previously fell through
without finding a matching network so that a similar case would be
easier to debug in the future.

Addresses bug #1131264

Change-Id: I7a8aaea5772707b8bd6313249e74b1302eedefe8
Make allocate_for_instance() return only info about ports allocated

Previously, the compute manager was filtering the results based on the
port id that the user requested. However, if they do not pass one (which
is valid) then we can not do the filter and we fail. This makes the
allocation function do the filtering, which should not affect the normal
use case where it is only called once, since all the ports returned were
allocated at that time.

The manager filter behavior is thus removed and a test is added to
verify that the allocate method does the right thing the second time
around.

This fixes the fallout found after fixing the actual cause of bug 1131264

Change-Id: I8f3af96051268503596007491af365e8ce28f5b3
Use min_ram of original image for snapshot, even with VHD

When snapshotting an instance there seems to be no reason that min_ram
can't be set based off of the original image in all cases.  This relaxes
the restriction that VHD backed instances set min_ram for snapshots
based on the current instance.

Bug 1133524

Change-Id: I3779c48d7325f3f0bde496f43a70017fe79d2835
Make sure no duplicate forward rules can exist.

Some failure conditions can cause floating forwards to not be properly
removed. We know that duplicate floating rules will never work, so
even if we have had other failures there is no need to create duplicate
forward rules. This patch fixes the issue by removing all existing
forwards for a floating ip before adding new ones. It adds a method
to IptablesTable to remove rules by regex and includes tests for new
method and the specific case of a duplicate forward.

Fixes bug 1133527

Change-Id: Iaf5df8406fc49e92bac328cd81ffda1969b77d68
Improve hackings docstring detection

Previously: def foo():\n    a = '''This is not a docstring'''
would be counted as a docstring even though it isn't.

Fix this and add docstring tests.

Fix bug 1100912

Change-Id: Id4d4aa382713eea340720e166e418262ba68eaaf
Add a 'hw_' namespace to glance hardware config properties

This updates the libvirt driver to use a 'hw_' prefix on
the names of hardware config properties it looks up for
glance images. Thus the new syntax for setting custom
hardware properties is

      # glance image-update \
               --property hw_disk_bus=ide \
               --property hw_cdrom_bus=ide \
               --property hw_vif_model=e1000 \
               f16-x86_64-openstack-sda

There is no back-compat support for the previous 'disk_bus',
'cdrom_bus' and 'vif_model' names, since they were never
made available in any formal release, only development
snapshots.

DocImpact
Blueprint: libvirt-custom-hardware
Fixes bug 1132739
Change-Id: Ic15ef0eba065113b35bbb2713be2532c858c3534
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Improve output msgs for _compare_result

In case of errors, the messages are now more detailed.
Fixes bug 1133621

Change-Id: I7747d7c4dcaf2199dc55139ee0235f6adca1ad36
Prevent hacking.py from crashing on unexpected import exception

If a module isn't importable due to an unexpected error during
__import__.  Ignore it, hacking.py is only a style checker.

Fix bug 1134622

Change-Id: I704b7cc9a7bd415018ae7634767b7bd9c3b7d9b2
ec2 _format_security_group() accesses db when using quantum_driver

This patch fixes _format_security_group() so that it does not
access the db when using quantum. In addition, this patch implements
the querying params that were missing in get() and list() in the quantum
security group driver.

Fixes bug 1131956

Change-Id: I5ec65829301bca7e5b215d5052a18528dff76517
Adds retry on upload_vhd for xapi glance plugin

Add a retry for the xapi glance plugin to handle transient issues
when uploading the vhd.

An example issue we're seeing is a connection timeout:

['XENAPI_PLUGIN_FAILURE', 'upload_vhd', 'error',
		"(110, 'Connection timed out')"]

To work around transient issues such as a connection timeout, we
should retry based on glance_num_retries before outright failing.

Change-Id: Ice6fdd3dd39ef40e5997d69209aaafa66bff5d6e
Fixes: bug #1134493
Fix `with_data` handling in test-migrations.

Two issues with the existing code:

1) migrate-down wasn't respecting the `with_data` flag

2) migrate-up was not actually migrating unless `with_data` was True.
The correct behavior is to always migrate up, but only run checks when
`with_data` is set.

Change-Id: I781fa4796908bea684d4499fa9ff5e4d7a18fbd4