Migrate existing routes from flat_interface

Right now, any routes that exist on flat_interface (other than the default
route) get lost when we set up the bridge. This patch migrates them over
to avoid losing that connectivity. It does so by using 'ip route' instead
of 'route', which is much easier to script and is consistent with other
use of iproute2 tools in linux_net.py.

Bug 962822

Change-Id: I7d9e8e05169f2f87e8481595397c02fd3a3612f4
Avoid casts in network manager to prevent races

 * Part of fix for bug 1017418

Change-Id: I3251f02fc5fcb8305f12b6b8a9644232b9146db2
Switch to using new config parsing for vm_vdi_cleaner.py

Fixes bug 1018166

Also uses CONF.verbose instead of passing verbose flag everywhere

Change-Id: Ifee832dd087cae8c36b7b7a4f08b2e22ef7f06a3
Add missing netaddr import

It looks like 345439f8 brought in netaddr dependencies without importing
the library itself.

Change-Id: Iabd58dd540e1d0c83482cb60538de7494099b34d
Merge "Avoid casts in network manager to prevent races"
Cleanup of image service code

* Remove image_service flag
* Move nova.image.fake to nova.tests.image.fake
* Move nova.image.get_default_image_service to
  nova.image.glance.get_default_image_service
* Move nova.image.get_image_service to
  nova.image.glance.get_remote_image_service
* Related to bp integrate-python-glanceclient

Change-Id: Iea6db7898328a9060fb88586e042efbc0a4351fc
Remove image service show_by_name method

This method isn't worth keeping around. It's used in one place and
consists of a try/except block. We also shouldn't encourage clients
of GlanceImageService to depend on finding a single unique image
by a non-unique attribute.

Change-Id: I02347adef7bc7ac70407226ea150000e55a798bc
Merge "Add missing netaddr import"
Swap VDI now uses correct name label.

Fixes bug 1018596

Change-Id: I788a762e3d3362c04c7d6986808d13f77d9c5a5e
Remove GlanceImageService.index in favor of detail

Since there is no difference in index vs detail in the v2 API,
let's drop that as a requirement in the GlanceImageService.

Related to bp integrate-python-glanceclient

Change-Id: If98cf68e7e18fa78a2f9c09526ca9e80d2e27c1b
Merge "Switch to using new config parsing for vm_vdi_cleaner.py"
Merge "Swap VDI now uses correct name label."
Merge "Cleanup of image service code"
Merge "Remove image service show_by_name method"
Merge "Remove GlanceImageService.index in favor of detail"
Use LOG.exception instead of logging.exception

Fix a typo in nova-all where logging.exception was used instead of
LOG.exception like the rest of the code uses

Change-Id: I6f88014e1c5d87a9b84bb2ac833931a93aaf96c0
Rename GlanceImageService.get to download

In preparation for integration with the new Glance client, this
drops the return of image metadata from GlanceImageService.get
in addition to renaming it to 'download'.

Change-Id: I75ca3a0a909335e74cd521da6f894c163e773e94
Fix regression in test_connection_to_primitive libvirt testcase

Commit aa9a592abcbfabad4d2a3f8bb49d1b28d7724262, which renamed
the libvirt module from 'connection' -> 'driver', accidentally
introduced a flaw in the test_connection_to_primitive libvirt
testcase.

The original code in that test case was

   connection = nova.virt.libvirt.connection.LibvirtDriver('')
   jsonutils.to_primitive(connection._conn, convert_instances=True)

Notice how the second line is using the '_conn' attribute on
the LibvirtDriver *object instance*

Now the new code is

   connection = libvirt_driver.LibvirtDriver('')
   jsonutils.to_primitive(libvirt_driver._conn, convert_instances=True)

Notice how the second line is using the '_conn' attribute on
the LibvirtDriver *class*. Predictably this causes the testcase
to fail due to the '_conn' attribute not existing.

Change-Id: Ie35718ea0c50648938effc53d67a110f280644d6
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Refactor libvirt config classes for representing CPU models/features

The previously added (but not used) LibvirtConfigCPUTest class
was too inflexible. It did not distinguish between parts of the
XML schema which applied to both capabilities & domain XML,
vs those which only applied to the domain XML. By representing
features as a plain string it did not allow for setting attributes
on feature flags like policy.  This change replaces the single
LibvirtConfigCPUTest class with 4 new classes:

 - LibvirtConfigCPUFeature - base class for defining CPU features
 - LibvirtConfigCPU - base class for defining CPU models
 - LibvirtConfigGuestCPUFeature - extension for setting the guest
   specific feature policy
 - LibvirtConfigGuestCPU - extension for setting the guest specific
   match policy, and allowing use of host CPU model passthrough

Fixes: bug #1003373
Implements: blueprint libvirt-xml-cpu-model
Change-Id: I0aa0ddfb86cf8b89b2e4dcc95e21bdca304bd6b3
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Add libvirt config classes for handling capabilities XML doc

Libvirt exposes the host/hypervisor features using an XML
schema known as "capabilities". Currently the libvirt driver
code just parses this in an adhoc manner using xpath queries.

This change provides a handful of classes LibvirtConfigCaps,
LibvirtConfigCapsHost and LibvirtConfigCapsGuest for maintaining
an object based representation of the capabilities. The
LibvirtConfigCapsHost class also uses the existing LibvirtConfigCPU
class

Fixes: bug #1003373
Implements: blueprint libvirt-xml-cpu-model
Change-Id: Ie962c6378b0da09eddc75983d4824a226ed1c25e
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>