Fix MeteringLabel model to not clear router's tenant id on deletion

foreign_keys parameter of orm.relationship should point to local columns.
Currently for MeteringLabel it points to Router.tenant_id column which causes
routers tenant_id clearing on label deletion.

Closes-Bug: #1249188
(cherry picked from commit d1220a3c22fccc1d86eaafeebe7ef9c074d4fcb9)
Change-Id: Iccc0daf4f6edd537fd7f9e4b2fc4be094543ca5d
Add fwaas_driver.ini to setup.cfg

Change-Id: Ie8157c0df343fb1009e7bc5b3ed2f2d4b0d0afec
Closes-Bug: 1258585
(cherry picked from commit daf0d68f9fc1f878ae29061dc43c19fd3e4950ef)
Add X-Tenant-ID to metadata request

Previously, one could update a port's device_id to be that of
another tenant's instance_id and then be able to retrieve that
instance's metadata. In order to prevent this X-Tenant-ID is now
passed in the metadata request to nova and nova then checks that
X-Tenant-ID also matches the tenant_id for the instance against it's
database to ensure it's not being spoofed.

DocImpact - When upgrading OpenStack nova and neturon, neutron
            should be updated first (and neutron-metadata-agent
            restarted before nova is upgraded) in order to minimize
            downtime. This is because there is also a patch to nova
            which has checks X-Tenant-ID against it's database
            therefore neutron-metadata-agent needs to pass that
            before nova is upgraded for metadata to work.

Change-Id: I2b8fa2f561a7f2914608e68133abf15efa95015a
Closes-Bug: #1235450
Fix unable to add allow all IPv4/6 security group rule

Previously, if one tried to add a rule to allow all ingress ipv4 neutron
would respond that the rule was already part of the security group.
This happened as the filter for querying existing rules uses a wildcard for
remote_group_id thus returning a false match. This patch addresses
this issue.

Change-Id: I0320013a3869d25fb424995354721929465d2848
Closes-bug: #1252806
(cherry picked from commit 9335ffd7c3eaad0d66d7d19e7760ae12476a5ea2)
Merge "Add X-Tenant-ID to metadata request" into stable/havana
Fix argument mismatch failure for neutron-check-nvp-config

Use sys.argv directly.

Fix bug #1243888

Change-Id: I9cb6ca841d004baf72dd68e44be673c361c2ed05
(cherry picked from commit e3e4a3fa2dac7a03169d095267ec492653524325)
Bump stable/havana next version to 2013.2.2

Change-Id: I3a7170180717bd62fce4cbc2c3a9107187f89fb1
NVP: propagate net-gw update to backend

When a network gateway's name is updated, propagate the
update to the backend.

Closes-Bug: #1261334
Change-Id: Icaae84e7f5373946e8c82e0e519528409925dd9d
Merge "Fix unable to add allow all IPv4/6 security group rule" into stable/havana
Fix a typo in log exception in the metering agent

This patch fixes a typo when there is a exception
when the agent try to invoke a method of the driver.
This patch also improves exceptions handling of
driver method calls.

Change-Id: I4fcf19fa84f178348abfb3563bbfd52f0dfcc095
Closes-bug: #1256041
(cherry picked from commit 272912b6d82af00a6f7bafc26d8ce7a79b09ef26)
Merge "NVP: propagate net-gw update to backend" into stable/havana
Merge "Add fwaas_driver.ini to setup.cfg" into stable/havana
Reduce the severity of dhcp related log traces

Due to timing issues, when the agent synchronizes
with the server wrt the representation of server's
and agent's networks, networks may have already
been deleted from the db. In such circumstances,
it is more appropriate to emit warnings rather than
full-blown exceptions as the agent handles these
circumstances just fine.

Close-bug: 1251874

(cherry picked from commit f1b9ac5a542a3125d757094fccda80c80c6dd420)

Conflicts:

        neutron/agent/dhcp_agent.py

Change-Id: I4b118b6087c7f42226f0d4265d2176c028d99f22
Catch PortNotFound exception during get_dhcp_port

Close-bug: 1252437

Change-Id: I3a7954b869b4f5b909c806f8e47180e1ba6ba374
(cherry picked from commit cbe91fda7b416717a23cf7b29adf8201a8c14822)
Change default eswitchd port to avoid conflict

Previous default for eswitch/daemon_endpoint would set a TCP port (5001)
which is in the range of the well known ports.
Change to unreserved port (60001) will avoid that conflict.

Change-Id: I711c4659f497e44a6041ec9958835c1f2f4174a7
Closes-Bug: #1245885
(cherry picked from commit cd542a7f1f2ea21d3694e70b8e6a6db0efbd3a01)
Fix check_nvp_config erroneous complaint

Add the missing ingredient to the boolean test. This is
not a straight cherry-pick from a trunk fix, as the
utility tool has been renamed in Icehouse.

Closes-bug: #1265353

Change-Id: I9eb8fc1f85b16fbae83930fa9723db1fd25eeb5d
Merge "Catch PortNotFound exception during get_dhcp_port" into stable/havana
Send DHCP notifications regardless of agent status

The Neutron service, when under load, may not be able to process
agent heartbeats in a timely fashion.  This can result in
agents being erroneously considered inactive.  Previously, DHCP
notifications for which active agents could not be found were
silently dropped.  This change ensures that notifications for
a given network are sent to agents even if those agents do not
appear to be active.

Additionally, if no enabled dhcp agents can be found for a given
network, an error will be logged.  Raising an exception might be
preferable, but has such a large testing impact that it will be
submitted as a separate patch if deemed necessary.

Closes-bug: #1192381
(cherry picked from commit 522f9f94681de5903422cfde11b93f5c0e71e532)

Change-Id: Id3e639d9cf3d16708fd66a4baebd3fbeeed3dde8
Add support for managing async processes

Interacting with a long-running asynchronous process requires the
use of non-blocking io.  This change adds a helper class that can
launch a long-running process and read stdout and stderr in a
non-blocking fashion via eventlet.

This functionality is intended to support monitoring ovsdb via
a long-running and root-privileged invocation of ovsdb-client.

The complexity of the system interaction in this patch suggested
the addition of a functional test that validated actual behaviour.
The test was added under the neutron/tests/functional path which
is now included in the testr search path.

Partial-Bug: #1177973

Change-Id: I9969e556acecf7a9e77d873371cc2ec2647be011
(cherry picked from commit acf0209b28e21eed60158967fab77468eb195e7c)
NVP plugin:fix connectivity to fip from internal nw

The current set of NAT rules configured in the NVP logical router
prevents instances on an internal network from establishing TCP
connections with a floating IP associate with an internal port
on the same Neutron network.

This patch add a SNAT rule to ensure connections coming from the
internal network always appear to the port associate with the
floating IP as coming from the external network.

Change-Id: I12da12ee136c61fddb04f2b216382b51d751a02c
Closes-Bug: 1221419
(cherry picked from commit ed2e32b03123ae8e7555b997152c1d8d941494f2)