Check the length of aggregate metadata

PostgreSQL gives an error if you try to shove 256+ characters
into a 255-character field. So we need raise a HTTPBadRequest
explanation if the length of aggregate_metadata.keys or
aggregate_metadata.values is above 255.

Change-Id: I2c778f2237ba5bd2aa8335a0eae80f3aad3e9157
Closes-Bug: #1219693
Add unit tests for ipv4/ipv6 format validation

We found a bug that the other jsonschema format check('uri') did
not work for input validation. There was not any unit tests for
the format check, then we could not find it in long term.
The bug is fixed with Ibb2b7f27c374136e6865b28786d10ca1365e5709 .
And this patch adds unit tests for the format 'ipv4' and 'ipv6'.

Change-Id: I6f6636708e3f9a4eee14451f2baacb50002f1db8
Related-Bug: #1326599
Separate the PCI device object handling code

Currently the PCI device object includes several functions like
alloc/free/claim etc. However, the NovaObject should not be used
this way, and it makes the PCI device object really different
with other NovaObject implementations.

This patch duplicates the PCI device handling code as separated
functions. No logic changes but simply code copy. A later patch
will delete the code at PciDevice object.

Closes-Bug: #1273852

Change-Id: I2389d29218d8619998f8df973004af004e8b1b76
Use new pci device handling code in pci_manager

As we remove some pci device method from PCI device object,
update the pci manager accordingly.

Closes-Bug: #1273852

Change-Id: I0ec0e7b03625888a207918816b6e2d537b6d7d54
Remove the device handling from pci device object

Remove the device handling code at pci device object to make
it similar to other NovaObject.

Remove some usage in test cases.

Closes-Bug: #1273852

Change-Id: I4487ae0b36de18365d12593f480c05f0fe726769
Cleanup and gate on pep8 rules that are stricter in hacking 0.9

Fix up pep8 failures for rules we previously gated on, but that are now
stricter in there enforcement.

Ignore E251 due to https://github.com/jcrocholl/pep8/issues/301

Change-Id: I62b33e97c44c4a5be436b381cfbdaeb31cd2638b
Add bulk create/destroy functionality to FloatingIP

This adds bulk create and destroy functionality to the FloatingIP
object, which in turn requires that the DB API return the list of
IPs that it created.

This also fixes a bug in the load routine for FloatingIP, which
would previously try to load a FixedIP object with id=None,
which doesn't make sense.

Related to blueprint compute-manager-objects-juno

Change-Id: Ie3c7a5e672fcdb3e0df3d0e46b905b237dcfa182
Completely object-ify the floating_ips_bulk V2 extension

This converts the floating_ips_bulk APIv2 extension from using
direct DB access to using the FloatingIP object.

Related to blueprint compute-manager-objects-juno

Change-Id: I5fa7637b5eb06a9be51d7638701d98e3e033d68d
Move the fixed_ips APIv2 extension to use objects

This converts the fixed_ips extension to use the FixedIP object
instead of direct database access.

Related to blueprint compute-manager-objects-juno

Change-Id: I21afae063a360c1c36a417f0455e213b7236b541
Object-ify server_password APIv2 extension

This makes the server_password extension use the Instance object
instead of direct database access.

Related to blueprint compute-manager-objects-juno

Change-Id: I54f7762d14868278ef72589a8c6e3fc80c0e48c8
Object-ify server_password APIv3 extension

This makes the server_password APIv3 extension use the Instance object
instead of direct database access.

Related to blueprint compute-manager-objects-juno

Change-Id: I960840e8261bacd4a9c99934f02342861e53bc74
Enhance and test exception safety in hooks

This patch adds exception handling when calling pre and
post functions of hooks. Exceptions will be caught and
logged, but the hook chain and function call will be
allowed to proceed.

Partially implements: bp instance-network-info-hook

Change-Id: I45e76cd156c244ff57f77db103a9a579f14ad4f1
Add hook for network info update

This hook will allow deployers to register scripts that will
be called whenever an instance's network information is updated.
Scripts will be called with original arguments of the network
info update function call.

Implements: bp instance-network-info-hook

Change-Id: I56ff28d305cf8d9a67b37c45062256b3899f11dd
Add EC2InstanceMapping object for use in EC2

The EC2 code has a table mapping instance UUIDs to EC2 IDs.  This patch
creates the Nova object for this so that we can remove direct use of
these db.api calls from the EC2 code.

Change-Id: Ib55426de29c1290ff9c7bcb999fb3b3124521750
ec2: Convert to use EC2InstanceMapping object

Update the EC2 code to make use of the EC2InstanceMapping object instead
of using the db API directly for managing instance UUID to EC2 ID
mappings.

Change-Id: I66d60a29f0d909edd381e8492a4754bdd0eb8e52
Rename VolumeMapping to EC2VolumeMapping

During the code review for adding the InstanceMapping object, a
request was made by a couple of people to rename it to
EC2InstanceObject.  I did that so now I think we should rename the one
that already merged to also have the EC2 prefix.

Change-Id: I0b0847b6d4e229c973e268045709fa90726baed9
Log cleanups for nova.virt.libvirt.imagecache

More log cleanups:
 - add log hints for error, warning and info levels
 - move from LOG.warning to LOG.warn

Change-Id: I452cf18f9a5199bfc1c1b104f6a2b03561bf2fc4
devref policy: code is canonical source of truth for API

Although many reviewers know that documentation isn't the source of
truth for API behavior, we have never written this policy down before.

Change-Id: Ibe7b355947200b668324028972c121e5357a0470
Merge "Check the length of aggregate metadata"
Merge "Cleanup and gate on pep8 rules that are stricter in hacking 0.9"