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
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
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
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()"
Imported Translations from Transifex

Change-Id: Iee6534fbffd02abd4cd116e308b25e1b5709dcb7
Merge "Adding netmask to dnsmasq argument --dhcp-range"
Rework time handling in periodic tasks.

Update time calculations in the periodic task handling to use the
timeutils module from oslo. This provides benefits for unit testing,
since we can easily override the time functions to simulate time
differences without having to actually sleep and make the unit tests
run unnecessarily long.

Resolves bug 1098979.

Change-Id: I1e6a0a0b1622a3f8c37c42376f5261f5f2dbf6fe
always quote dhcp-domain, otherwise dnsmasq can fail to start

the dnsmasq arg --dhcp-domain can't be passed to dnsmasq as empty
(i.e. --dhcp-domain= ) unlike many other arguments. If you do pass
it as empty, dnsmasq won't start, throwing a ProcessException which
then crashes the rest of nova-network.

Fix this by quoting dhcp-domain so that empty domains are allowed.

Fixed bug #1161027

This was found by grenade upgrade testing

Change-Id: Id24814339d8c8a709f5041f0aa98b10ba1e0e595
Merge "Make iptables drop action configurable."
Merge "Make tenant_usage fall back to instance_type_id"
Merge "Fix quantum nic allocation when only portid is specified"