Big Switch Plugin: No REST port delete on net del

Moves the REST call for port deletion out of the
_delete_port method into the delete_port method
so it doesn't get called during a delete_network
operation. The backend controller automatically
removes ports that are a member of a network when
it's deleted.

Closes-Bug: #1295438
Change-Id: Ic09eb722f8e9bd3ce298dee90d8415cda1a1aa7a
VPNaaS support for VPN service admin state change and reporting

For VPN service admin state changes, hook up the API call to the service
driver so that the configuration changes can be applied.

Modify the status reporting, so that the VPN service and IPSec
connection status' match the actual status when admin state down
actions are performed (on both the service and connection).

Change-Id: Ife7176675d20bb3ea529a4d79fa92a61f9550a6a
Closes-Bug: 1291609
Fix segment allocation tables in Cisco N1kv plugin

The segment allocation table is emptied on deleting any network profile.
This change allows the use of segment range from the network profile table.
By using the network profile UUID as a foreign key in the segment allocations table,
tables are cleaned up only for the segments associated with
the deleted network profile via CASCADE, leaving no inconsistencies.

Change-Id: I507041fac3768a7b688ddcf28c4d97c618bfe3f9
Closes-Bug: #1288407
LBaaS: make device driver decide whether to deploy instance

Currently server throws an error in case agent (device driver)
requests logical config for non-active pool, which is a bug
as it's ok if pool is in pending create/update states.
Also the pool may be already scheduled for delete (pending_delete)
while agent requests it to perform some previous update, which
as also ok and agent just doesn't deploy such config.

This patch moves active pool check from server side to agent side

Closes-Bug: #1295491
Change-Id: Ib088355a0b3efffdcd211a8cfe6942833bb9f895
Correct OVS VXLAN version check

Update the version checking logic used to determine if the combination of
Linux kernel, OVS userspace, and OVS kernel module can properly support
VXLAN.

Tested on Ubuntu 14.04 without the OVS DKMS module.

Closes-Bug: #1291535

Change-Id: If034164b775989d52c3c449caba6baadb970afd9
Include cisco plugin in migration plugins with ovs

Currently we have many migration files with missing cisco
plugin in migrate_plugin when ovs is included.This
causes missing tables when cisco plugin is enabled
and migration is run. This fix should automatically
include the cisco plugin if ovs is detected in the
migrate_plugins.

Change-Id: I4dedfbafe9b431e85255d5427766e22eed09ee5e
Closes-Bug: #1292114
Migrate data from cap_port_filter to vif_details

There was introduced a new column vif_details for ml2_port_binding table
and dropped cap_port_filter column. Data was lost during the migration
causing no data in vif_details.

This patch transforms data from cap_port_filter to vif_details column as
a part of db migration. MigrationContext.execute() calls underlaying
methods depending whether migration is online or offline therefore data
are migrated in offline migration too.

Partial-bug: #1235149
Change-Id: Icc5dc6e8221a542f5190d0222ac4d10197d15ac1
Import request_id middleware bug fix from oslo

There is a bug in request-id middleware that a subsequent API request will
overwrite a request-id of a previous request when multiple API calls are
processed in parallel in request_id middleware.
This commit imports the fix in oslo.

cherry-picked from oslo-incubator d7bd9dc37ac3d6bc171cd2e290c772633ad20a32
Closes-Bug: #1289696
----
Don't store the request ID value in middleware as class variable

The original version of the request_id middleware generates a request ID during
process_request() and stores the value in a variable, so it can be attached as
header in process_request(). This is pretty dangerous, since subsequent
requests will overwrite this value, and the wrong request ID may be attached to
some responses. This is particularly apparent when requests arrive in parallel.

This change replaces process_request() and process_response() with an override
of __call__(). This allows the generated req_id to be used in the response
header without needing to save it as a class-level variable.
----

Change-Id: Ic20047f604394f1ce4900c3b6a00595223804cba
nec plugin: allow to delete resource with ERROR status

Previously if a resource is in ERROR status and there is no
corresponding resource on OpenFlow controller, the resource
cannot be deleted through an API request.
This commit rearrange ERROR status check to allow resource
with ERROR status to be deleted.

Closes-Bug: #1295754
Change-Id: I709f5e2066eb5d12ec0f42dff15797acddc2009e
Subnets should be set as lazy='join'

Currently if one does a net-list tons of queries are issued against the
database as the default query mode is 'select' which performs a query when
the field is actually accessed. In this patch I change the the mode to
'joined' so subnets are loaded as the networks are loaded. Usually, there
are only 1 or 2 subnets on a network so loading this data shouldn't hurt.
This patch in my setup with 5000 networks reduces the net-list call from 27
seconds to 7! Woot Woot :)

Change-Id: I10eec4d79b522dfd685d3d2aa93a8d643104bba7
Closes-bug: 1298053
Adds OVS_HYBRID_PLUG flag to portbindings

Adds a flag to the ML2, openvswitch, and BigSwitch
plugins to inform nova that the OVS hybrid plugging
strategy should be used.

Closes-Bug: #1112912
Change-Id: If004db60e084f4cea095ca9ecccb0537240d4183
Merge "LBaaS: make device driver decide whether to deploy instance"
Prevent cross plugging router ports from other tenants

Previously, a tenant could plug an interface into another tenant's
router if he knew their router_id by creating a port with the correct
device_id and device_owner. This patch prevents this from occuring
by preventing non-admin users from creating ports with device_owner
network:router_interface with a device_id that matches another tenants router.
In addition, it prevents one from updating a ports device_owner and device_id
so that the device_id won't match another tenants router with device_owner
being network:router_interface.

NOTE: with this change it does open up the possiblity for a tenant to discover
router_id's of another tenant's by guessing them and updating a port till
a conflict occurs. That said, randomly guessing the router id would be hard
and in theory should not matter if exposed. We also need to allow a tenant
to update the device_id on network:router_interface ports as this would be
used for by anyone using a vm as a service router. This issue will be fixed in
another patch upstream as a db migration is required but since this needs
to be backported to all stable branches this is not possible.

NOTE: The only plugins affect by this are the ones that use the l3-agent.

NOTE: **One should perform and audit of the ports that are already
        attached to routers after applying this patch and remove ports
        that a tenant may have cross plugged.**

Change-Id: I8bc6241f537d937e5729072dcc76871bf407cdb3
Closes-bug: #1243327
Make dnsmasq aware of all names

Each dnsmasq instance on a network is not aware of other dnsmasq's leases.

When dnsmasq is launched with --no-hosts and is not provided an --addn-hosts
file, it can resolve only the hosts to which it gives a dhcp lease and no more.
i.e.:
If dnsmasq service n°1 gives a lease to instance n°1, and dnsmasq service n°2
gives a lease to instance n°2, both VM instances and dnsmasq services being on
the same network: instance n°1 can not resolve instance n°2, because instance
n°1 queries dnsmasq n°1, and since it did not give the lease to instance n°2,
it can not resolve it (it is not aware of its existence). Same issue if
instance n°2 tries to resolve instance n°1.

The solution is to provide dnsmasq with an --addn-hosts file of all hosts on
the network. With an --addn-hosts file, each dnsmasq instance is aware of all
the hosts on the network even if they do not give the lease for a host,
therefore each dnsmasq instance can resolve any host on their network even if
they did not provide the lease for it themselves.

Change-Id: Ic6d4f7854d250889dded5491e4693fcdce32ed00
Fixes: bug #1242712
Merge "Import request_id middleware bug fix from oslo"
Merge "Correct OVS VXLAN version check"
Merge "VPNaaS support for VPN service admin state change and reporting"
Merge "nec plugin: allow to delete resource with ERROR status"
Merge "Make dnsmasq aware of all names"
Merge "Prevent cross plugging router ports from other tenants"