Adding ability to specify the libvirt cache mode for disk devices

In past versions of Nova it was possible to explicitly configure
the cache mode of disks via the libvirt XML template. The current approach
makes this a derived setting of either “none” or “writethrough” based
on the support of O_DIRECT. Whilst this provides a good set of default
settings it removes the ability of the cloud provider to use other
modes such as “writeback” and “unsafe” which are valuable in certain
configurations.

This change allows the cache mode to be specified on a per-disk type
basis. If a disk type does not have a cache mode specified then the
default behaviour remains unchanged.

DocImpact

bug 1086386

Change-Id: I3d296fe0b4b9b976db02db90ad69fd299cd2096a
Updates to OSAPI sizelimit middleware.

Updates the OSAPI sizelimit middleware so that we use avoid calling
len on a request body which could cause a really large request
to get buffered into memory.

Also updates the middleware to return HTTP 413 which is a more
correct error code in this case (previously it returned just 400).

Fixes LP Bug #1131857.

Change-Id: Id8bc5eeb0fba9482809edd12543a75163e1227e9
libvirt: lxml behavior breaks version check.

lxml doesn't roundtrip empty strings, meaning if you serialize
and element with value '', when you derserialize it, the value will be
`None`.

This broke the version_string_with_package check because None and ''
will not compare as equivalent.

The solution is to coerce the None value back to an empty string before
running the check.

Change-Id: Ia3a8ae68f12a4645057d243fdee59197df40e8d3
Prevent default security group deletion.

This patch adds a check to confirm that a security group name
is not among a list of 'special' group names before proceeding
with security group deletion.

Fixes: bug 1131830

Change-Id: I5656e01b4ed3fd9c22abe6a731edaef7203d97c4
Ensure macs can be serialized.

This patch uses to_primitive() to ensure that the macs argument to the
rpcapi method allocate_for_instance() can be serialized by rpc drivers.
Specifically, the powervm driver uses a set() here, and that will cause
breakage in non-kombu drivers.

Fix bug 1131035.

Change-Id: I5729c5854799e49c6598e4dd2a4da487598307f1
Merge "Prevent default security group deletion."
Merge "Ensure macs can be serialized."
Merge "libvirt: lxml behavior breaks version check."
Merge "Updates to OSAPI sizelimit middleware."
Merge "Adding ability to specify the libvirt cache mode for disk devices"