Make iptables drop action configurable.

Resolves bug 1013893 by allowing the setting of the iptables drop
action with a configuration flag. It is expected that this would be
used for run a LOGDROP action before actually dropping the packet.

DocImpact: the drop action for iptables rules can now be configured
for nova-network users with the iptables_drop_action flag.

Change-Id: I15720d2742955611929a4d7181a269795296e025
Add missing tests for db.instance_type_* methods

There was no tests in test_db_api for instance_type_* methods.

Add tests to ensure that all works.
Also these tests allow us to refactor work with session and
to add missing unique constraints.

Fix bug in instance_type_get_all, we shouldn't remove
is_public from input filters dictionary.

blueprint db-api-tests

Change-Id: Ia02d73e6ffd964d6edb605039eb95e9f90ff0482
Remove race condition (in InstanceTypes)

Soft delete all duplicate rows with the same name except one with
the biggest value in `id` column.

Soft delete all duplicate rows with the same flavorid except one with
the biggest value in `id` column.

Create UC on columns (name, deleted) and (flavorid, deleted)

Replace Select then Insert -> Try to Insert.

blueprint db-enforce-unique-keys

Change-Id: If66d2f1387c2b2748784bf7ac9746b8d755b70a9
Add missing tests for db.instance_type_access_* methods

There was no tests in test_db_api for instance_type_access_* methods.

Add tests to ensure that all works.
Also these tests allow us to refactor these methods.
For example add missing unique constraint on columns
(instance_type_id, project_id)

blueprint db-api-tests

Change-Id: Idfeda1685ef8c812c1211783aede15795b0d7caf
Adding netmask to dnsmasq argument --dhcp-range

By default, dnsmasq will try to guess the proper subnet size but
sometimes it will fail. This patch provides the network netmask
to dnsmasq via the --dhcp-range argument.

Fixes: bug #1154929

Change-Id: I74d62c837b5310004b9151851697e3ea3b475f92
Always store old instance_type during a migration

Previously, we were trying to optimize for the migration (as opposed
to resize) case by not storing the old_ instance_type. However,
this is confusing to the vast amount of shared code that works on
migrations and resizes because the "is old == new" logic must be
replicated everywhere. To cut our losses and hopefully avoid other
hidden dragons, this patch removes the optimization and makes both
paths the same.

Fixes bug #1160489

Change-Id: I2ad7b02239baada5fd2174f5b61cdc90ec91e6f5
Adds Tilera back-end for baremetal

blueprint add-tilera-to-baremetal.

The baremetal driver is a hypervisor driver for Openstack Nova
Compute. Within the Openstack framework, it has the same role
as the drivers for other hypervisors (libvirt, xen, etc). With
this patch set of tilera-backend, provisioning and management
of non-PXE tilera physical hardware is accomplished using
common cloud APIs and tools.

Change-Id: I356c06a07ace463779e3b84836d5000331e24814
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
Co-authored-by: Devananda van der Veen <devananda.vdv@gmail.com>
Imported Translations from Transifex

Change-Id: I2b7d153fc4e0d810c034a4866d5e4c731ba799ee
Bring back colorizer again with error results.

This was actually a pretty simple fix. When I switched the base
test result class to testtools I lost the methods that were
printing out the errors at the end. This adds the (colorized!)
methods so errors print successfully.

fixes bug 1159116

Change-Id: Ib09d7e18ddf27015ff735a30137421d865382359
Merge "Adds Tilera back-end for baremetal"
Merge "Always store old instance_type during a migration"
List AZs fails if there are disabled services

Trying to list availability zones when there is a disabled
services fails with a 500 error

Fixes bug #1160841

Change-Id: Ibdb639f0d6a1a69a6a6331ee053c75449a16fc8f
Add a format_message method to the Exceptions

This patch adds a format_message method to the NovaException class that
will almost always do what a user wants, when they want to print out the
message of the exception.

Exceptions that are received through RPC are turned into an actual
exception classes by the deserialize_remote_exception function of the
nova.openstack.common.rpc.common module. This function then overrides
__str__ and __unicode__ methods of a new class to print the whole trace.
We still want to preserve this functionality (for logging) but do not
want to leak the trace back to the user in the HTTP response.

Based on the above, This patch attempts to establish a convention that
states: if you need to get the message of a NovaException subclass -
always use the format_message method. Only use str(e) or unicode(e) when
you suspect that they were overriden.

Initially this was attempted through adding a custom metaclass to the
NovaException class so that format_message cannot be overridden in
subclasses, however due to a bug in testtools - many tests were failing.
A patch was proposed to testtols to remedy this
(https://github.com/testing-cabal/testtools/pull/34) however until it is
merged, we cannot use metaclasses with our exception classes as they
cause tests to fail.

Change-Id: I0a399b9ab3227bad644b031c9b689fe0ce64586e
Use format_message on exceptions instead of str()

This patch changes all usages of unicode() and str() in the API layer
(and most other reasonable places) into a new format_message method.
This is done in order to avoid leaking the stack trace back to the
user through the Remote excepitons.

This patch deliberately avoids the EC2 api as the way how the EC2 API
handles responses is being worked on as part of another blueprint.

Fixes bug 1159755

Change-Id: I04a74682c4fac9a66ba25b52fd5c7af5e10e81e8
Merge "Bring back colorizer again with error results."
Make tenant_usage fall back to instance_type_id

In order to expose historical usage information about instances that
were deleted at the time migration #153 was run, we need to fall back
to looking up type information by instance_type_id.

This patch does that (only for deleted instances) and replicates the
previous behavior of skipping instances that have an instance_type_id
that points to a non-existent type.

Fixes bug 1161022

Change-Id: I39d30c59d1711d8f2a61c7a5e2545b3952e55dbe
Merge "Add missing tests for db.instance_type_* methods"
Fix quantum nic allocation when only portid is specified

A simple omission at the end of allocate_for_instance() was preventing
the function from returning information about the newly-allocated port
if one was not actually allocated from a network (i.e. if it was
provided as input). This fixes that and adds a test which would have
caught it.

Fixes bug 1160560

Change-Id: Ib0d7d91acfe5bd684cdfc072fe47c8115c2f91b3
Merge "Add a format_message method to the Exceptions"
Merge "Use format_message on exceptions instead of str()"