Organize limits units and per-units constants

During v3 api review there was an agreement that would be nice to move limits
constants to utils file and refactor its usage inside limits api to avoid
unnecessary code duplication.

Also changed TestLimiter class to MockLimiter since that name can be confuse to
some unit test frameworks.

Change-Id: I1b8626e8d1e3257333d4dfee61591fd4cde82bd1
Port server_diagnostics extension to v3 API Part1

This changeset only copies the v2 files (implementation and test)
into the appropriate v3 directories unchanged. The copy as-is
will not be loaded by either the v2 or v3 extension loaders. The
second changeset will then make the changes required for it to
work as a v3 extension.

This is being done in order to make reviewing of extension porting
easier as gerrit will display only what is actually changed for v3
rather than entirely new files

Implements blueprint nova-v3-api

Change-Id: I52f906948b5873cf3fdfff14270c7384ee5e7b9f
No support for double nested 64 bit guest using VCDriver

64bit instances launched on ESX via the VCDriver will not
support running 64bit guests. There is an option that can
be passed during the vmx creation that will allow for this
to happen. This is very useful if you want to run hypervisors
 (esx, kvm) on top of ESX and then run 64bit VMs on top of
those hypervisors.

Fixes bug 1192256

Change-Id: Id6eb224c97569737cbb41f1b64f61805e1df004e
Sync db.models.Quota* with migrations.

Blueprint: db-sync-models-with-migrations

Change-Id: Ic97690b650151eb7086cbd40093c0f3c373133e2
Add AggregateRamFilter

Implements blueprint per-aggregate-resource-ratio

* AggregateRamFilter to support per-aggregate ram_allocation_ratio
* Falls back to global setting if per-aggregate value not found

DocImpact

Change-Id: I93e069f0ac3f595d9a2a17119274c7bfbe8fca31
Add AggregateCoreFilter

Implements blueprint per-aggregate-resource-ratio

* AggregateCoreFilter to support per-aggregate cpu_allocation_ratio
* Falls back to global setting if per-aggregate value not found

DocImpact

Change-Id: I9230f46e2490226f3c50d616aa173d4722095087
Baremetal_deploy_helper error message formatting.

Updates our baremetal_deploy_helper so our error message use
formatting that works with translations.

Change-Id: I8811df50f0e80c5680e6316c829a197b0ade5967
db.compute_node_update: ignore values['update_at']

When individual instances are updated (e.g., during spawn and
terminate), ResourceTracker (in nova.compute.resource_tracker)  calls
compute_node_update with values=self.compute_node. Since
self.compute_node is an instance of ComputeNode that was retrieved
from the database, it has updated_at set. Since updated_at is in
values, sqlalchemy doesn't automatically change the record's
updated_at column (see
nova.openstack.common.db.sqlalchemy.models.TimestampMixin). Moreover,
since updated_at is set to the last value's updated_at, updated_at
effectively doesn't change until values without updated_at are sent,
which only happens during the periodic task that calls
ResourceTracker.update_available_resources.

Nova-scheduler relies on ComputeNode.updated_at to keep its model of
available resources up-to-date. In particular, nova-scheduler doesn't
play a role in instance termination, so it doesn't account for freed
resources until ComputeNode.updated_at changes. Thus, between
nova-compute's periodic calls to
ResourceTracker.update_available_resources, nova-scheduler's model of
available resources monotonically decreases. If, for example, a node
has resources for 10 instances, and you manage to boot 10, terminate
10, then attempt to boot another before the end of the period,
nova-scheduler won't schedule the new instance on the vacant node.

Fixes bug #1194900.

Note that f398b9e195cda582bad57396b097dec274384c07 fixed a separate
issue (bug #1153778) related to ComputeNode.update_at being stale.

Change-Id: Ifd1e56edfd811241816970715071876857de80d3
Fix a couple typos in the nova.exception module

This patch fixes a couple of typos in localized user-facing strings in
the nova.exception module.

Fixes bug 1194944

Change-Id: Ia85e69c23832ab4fd9f56c525075bd30bf4b059e
Better default for my_ip if 8.8.8.8 is unreachable

Run if route/show, extract ipv4 addresses and pick the first one.
Fall back to 127.0.0.1 as before if we don't find anything
or if we have running the ip route/show commands

Fixes LP# 1193013

Change-Id: If73f0f6bf67f858f7506220debab0f74cc9e3cb4
Allow retrying network allocations separately

Introduce a new config option, 'network_allocate_retries', that allows
one to retry network allocations.  The default is 0 for no retries to
match the current behavior.

The network allocations currently get retried by a full retry of a build
via the scheduler, if those are enabled.  This patch reduces the need to
re-schedule for simple network allocation issues.

The retrying happens in the network alloc async greenthread, so for virt
drivers that support the new NetworkModel, the retrying potentially
happens in the background while the image is being downloaded, etc.

DocImpact

Change-Id: I1a5fdcccbb736fc0b1d8c0cbc3b45a8372a6aef7
Remove broken config_drive image_href support.

image_href support has not been working since at least shortly before
Folsom release.  This is a good indication that this functionality is not
used.  As far as I can tell, the docs also do not match what was
supported.  An image ID was required, but docs show examples with full
hrefs.

DocImpact

http://docs.openstack.org/developer/nova/api_ext/ext_config_drive.html

References to supporting image_hrefs should be removed.

This patch also removes the hack that passed a config_drive_id via
the Instance dictionary when config_drive_id is not a valid Column for
Instance.

Fixes bug 1186401

Change-Id: Iced7bc8e278cb9f208183f1dbb7a293675a47eae
Fix metadata access in prep for instance objects

Related to blueprint unified-object-model
Fixes: bug #1192012

Change-Id: I8b708dc3d89fedfcb4bbf5d26b959da1298b0525
Remove trivial cases of unused variables (3)

Kill some of the variables marked as unused by flakes8. This should
allow to enable F841 check in the future.
Only trivial cases with no function calls and obviously pure functions
(like datetime.now(), or len()) are cleaned up here.

Part 3, split to reduce conflicts.

Change-Id: I7b8e806ddd7b0e077243d4e31de140cd08fe0155
Merge "Sync db.models.Quota* with migrations."
Fix resizes with attached file-based volumes

Bug 1190364

get_instance_disk_info() now takes an additional, optional argument
of block_device_info. When passed in, we use it to filter out
volumes, such that they are not returned. Previously, any devices
classified as "file" as parsed from the instance XML were considered
local disks. This assumption is incorrect, since some volumes are
simply files, rather than block devices.

Added a new test, based almost entirely off the existing test case
for this function, which represents an XML file with two fake
file-based (NFS-like) volumes and associated block_device_info to
claim those volumes.

Change-Id: I4809a8fd68eb0f709347aa7cad0fa85389ade41c
Merge "Organize limits units and per-units constants"
Merge "Baremetal_deploy_helper error message formatting."
Merge "Fix metadata access in prep for instance objects"
Merge "Remove trivial cases of unused variables (3)"