separate Metadata logic away from the web service

The changes here are coming as a result of starting on blueprint
config-drive-v2 [1].  I wanted to separate out the "Metadata" from the
"Metadata Server".  Thus, the creation of nova/api/metadata/base.py.

The InstanceMetadata in base.py contains most of the logic for
presenting metadata.  As a result, the Metadata webservice in handler.py
greatly simplified.  This should make it easier to render duplicate
data to a config drive.

Additional changes here:
 * a few more tests
 * removal of the separate 'Versions' handler.  Its now replaced
   by the single handler.

Change-Id: I35fcfd8d7f247763954afc0a9f752f629b243e9b
Log connection_type deprecation message as WARNING

Updates the connection_type log messages to log as
a warning instead of an error.

Fixes LP Bug #1011788.

Change-Id: I4cc2d9d5fdea2c8871f760b73a905fe61edcbe8f
Remove utils.deprecated functions.

We don't seem to use utils.deprecated at all... so lets
remove it and save ourselves 200 lines of code.

Also moves a couple misc. test cases in utils.py out of the
DeprecationTest suite and into the GenericUtilsTestCase
suite.

Change-Id: I03f71f2ee06a526a8902a3079257afd6fd65dc59
Adds property to selectively enable image caching.

The image-property `cache_in_nova` can be used to choose which images
should be cached in Nova. One use-case would be to cache base images but
not any customer snapshots.

Change-Id: I1b8ac914a6effd4cd4653aae7e4eac9d14d0e7bd
Revert "Fix nova-manage backend_add with sr_uuid"

Fixes bug 988596

Change 77495cfe breaks storage manager, as it makes a
wrong assumption about nova-manage. The sr-uuid must be
generated and provided by the xenapi storage manager.

When the volume service is started, SM volume driver will
create a new SR for everything that does not have an
existing sr_uuid and will populate the db with the result.
It will only introduce the SRs that do have one. The introduce
will work only if the uuid provided is something SM understands.

This partially reverts commit 77495cfed17f12f225e11fbc10e0f8db516dadf2.
Changes in db are left intact.

Change-Id: I8405ac905a15f829f704951b94297f3b6f6c0a29
Add two missing indexes for instance_uuid columns.

sqlite has these indexes because they were in the sql scripts, but
they're missing from the other database engines.

Change-Id: I2a1935f6eb577d2c3d2eb177c083ad647f76f58f
Dedupe native and EC2 security group APIs.

Reduce the code duplication in the native openstack and EC2 APIs
related to security groups, by factoring commonality into a new
internal SecurityGroupAPI.

Also fixes bug lp 1005931

Change-Id: Ifb92bf5d0f07d5713818a3eee6175ef03e8c0b7c
Add support for configuring libvirt VM clock and timers

There are a number of time sources made available to guests,
each of which have a number of configurable policies. This
introduces config APIs for the libvirt domain XML to configure
the clock time sources

Change-Id: Ic5047b02b4753f20bb9a63e85130d84258df7a28
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Update default policies for KVM guest PIT & RTC timers

The default policies for the KVM guest PIT and RTC timers
are not very good at maintaining reliable time in guest
operating systems. In particular Windows 7 guests will
often crash with the default KVM timer policies, and old
Linux guests will have very bad time drift

Set the PIT such that missed ticks are injected at the
normal rate, ie they are delayed

Set the RTC such that missed ticks are injected at a
higher rate to "catch up"

This corresponds to the following libvirt XML

  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
  </clock>

And the following KVM options

  -no-kvm-pit-reinjection
  -rtc base=utc,driftfix=slew

This should provide a default configuration that works
acceptably for most OS types. In the future this will
likely need to be made configurable per-guest OS type.

Fixes LP bug #1011848

Change-Id: Iafb0e2192b5f3c05b6395ffdfa14f86a98ce3d1f
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Remove unused DB calls

Fixes bug 1012301: Remove unused Cells code

Change-Id: I7e78e7c4ae3b099c775be2acc54b37f1e1b9883e
blueprint lvm-disk-images

Add ability to use LVM volumes for VM disks.

Implements LVM disks support for libvirt driver.

VM disks will be stored on LVM volumes in volume group
 specified by `libvirt_images_volume_group` option.
 Another option `libvirt_local_images_type` specify which storage
 type will be used. Supported values are `raw`, `lvm`, `qcow2`,
 `default`. If `libvirt_local_images_type` = `default`, usual
 logic with `use_cow_images` flag is used.
Boolean option `libvirt_sparse_logical_volumes` controls which type
 of logical volumes will be created (sparsed with virtualsize or
 usual logical volumes with full space allocation). Default value
 for this option is `False`.
Commit introduce three classes: `Raw`, `Qcow2` and `Lvm`. They contain
 image creation logic, that was stored in
 `LibvirtConnection._cache_image` and `libvirt_info` methods,
 that produce right `LibvirtGuestConfigDisk` configurations for
 libvirt. `Backend` class choose which image type to use.

Change-Id: I0d01cb7d2fd67de2565b8d45d34f7846ad4112c2
Add missing ack to impl_qpid.

Fix bug 1012374.

Johannes Erdfelt pointed out that impl_qpid wasn't acking messages that
it received.  This turned out to be a nasty oversight, resulting in
unbounded message queue growth inside of the python-qpid library.  This
fixes it.

Change-Id: I0370293807f0282e1dbdd59246f70be031e888a9
Log warnings instead of full exceptions for AMQP reconnects.

Fixes bug 1010147.

Change-Id: I1af7614330307dfdf5c723710334a168bc30b50f
Merge "Remove utils.deprecated functions."
Merge "Log connection_type deprecation message as WARNING"
Merge "blueprint lvm-disk-images"
Merge "Log warnings instead of full exceptions for AMQP reconnects."
Merge "Add support for configuring libvirt VM clock and timers"
Merge "Update default policies for KVM guest PIT & RTC timers"
Merge "Remove unused DB calls"