Remove SELECT FOR UPDATE use in ML2 type driver release_segment

SELECT FOR UPDATE expression, which is triggered with the use of the
SQLAlchemy Query object's with_lockmode('update') method, is
detrimental to performance and scalability of the database
performance code in Neutron due to the lock contention it produces.

SELECT FOR UPDATE can be entirely avoided in release_segment methods
with the use of single-shot UPDATE and DELETE expressions, and this
patch clears a number of uses of SELECT FOR UPDATE by consolidating
multiple SQL expressions into one.

Partial-Bug: #1330562
Change-Id: I29ffcafc8d4d73ac1cb50c94df5da85514d47a3f
validate flat networks physical name

Modified flat driver to validate the physical network
name - we make sure that empty names are deducted.

unit test changes:
- added two tests to make sure that we detect empty
  physnet names
- fix bug in existing unit-tests
-- flat_networks should be a list of string and not string
- use conf to setup flat_network

Change-Id: Ib7cfbd3c97d2e95c82044a2cba683c917ea54a84
Partial-bug: #1325664
LBaaS new object model logging no-op driver

Implements: bp/lbaas-objmodel-driver-changes
Change-Id: I39dccb93c6f9bd3264afbf0acc55a56fc6fd05a1
lb-agent: ensure removed devices get treated on resyncs

The previous exception handling in daemon_loop reprocessed all existing
devices as if they were new devices. However, it did not ensure that
any removed devices got cleaned up properly. This could result in
leftover security group iptables rules from deleted instances.

This patch refactors daemon_loop and scan_devices so devices that were
flagged for cleaning will get retreated in the next iteration if there
is an exception.

Change-Id: Ieada34ad315c0c29aa8462ebf041a448fde007b8
Closes-Bug: 1145610
Stop the dhcp-agent process when dnsmasq version is not determined

When it is not possible to determinate the dnsmasq version
or dnsmasq is not installed, neutron shows only a warning message.
With this commit the dhcp-agent process will be stopped if the
dnsmasq service is not installed.
Modifies the dhcp version unit test with the expected SystemExit exception

Change-Id: Ia26eaae6f432305f412a4b6a4a6b2b7b15d99d45
Closes-Bug: 1212401
Updated from global requirements

Change-Id: I4e105ae586e8a2379f3025f6f0d0344738b4e925
BSN: Remove db lock and add missing contexts

Adds context tracking decorators that were missing
from router interface methods. Without them, new
sessions were being created instead of using the
existing context which was causing transaction
issues.

Modifies the servermanager to store context references
as weakrefs so if multiple functions are called before
the rest functions are called, the first one doesn't steal
the only context reference with a pop() call.

Removes a DB lock for update in the server manager that occured
during rest calls that was triggering deadlocks due to the
file lock synchronization for the rest calls.

Closes-Bug: #1336251
Change-Id: Iad3d61e2c23832b3ad760a999fbab7feaa13f805
Merge "lb-agent: ensure removed devices get treated on resyncs"
Merge "Stop the dhcp-agent process when dnsmasq version is not determined"
NSX: fix indentations

Commit f43eb49f56accab87e4d1b6defcf78d1e697f9e6 had invalid
indentations.

Change-Id: I795d1960e79cc6fae889fbe8fca264d9e60e6f08
Add configurable http_timeout parameter for Cisco N1K

http_timeout is a constant defined in the code. This
change makes it configurable by providing it as an
option in the config file.

DocImpact

Closes-Bug: #1332290
Change-Id: I429dd9efa43f6a596933359f4627a7761411e621
Merge "LBaaS new object model logging no-op driver"
Merge "BSN: Remove db lock and add missing contexts"
Merge "validate flat networks physical name"
Merge "Updated from global requirements"
Ignore variable column widths in ovsdb functional tests

The ovsdb tests check the output of "ovsdb-client monitor" before and after
some operations. The first line of output is a header row with spaces for
column separation. The column widths can vary depending on the data in the
columns, so compress multiple spaces to one for testing.

Change-Id: I6b4690ea9ef1c1b215411ca2c39b1e65fec2c6c7
Partial-bug: #1336172
Fix OVSBridge.get_port_ofport to handle empty output

Previously ovs_lib.OVSBridge.get_port_ofport() was not handling the
case where db_get_val() was returning None when no output was recieved
from ovs-vsctl.  This patch ensures that the TypeError that results
from this condition is appropriately handled.

Change-Id: I168eb0f2c6f0cb98a3eb3e118972bbaf0383ff89
Partial-bug: #1336172
Allow setting a rootwrap cmd for functional tests

Previously, sudo-requiring functional tests hardcoded the use of
'sudo' as the root helper.  Devstack gate jobs do not allow
password-less invocation of 'sudo', though, so such tests were unable
to run in the gate.  This patch adds the ability to configure the
rootwrap command installed by devstack by setting the OS_ROOTWRAP_CMD
environment variable in the test execution environment, allowing
sudo-requiring tests to run.

Change-Id: I3b8f6b4f14ac1743e08b9401f73951885165350a
Partial-bug: #1336172
Merge "NSX: fix indentations"
Merge "Ignore variable column widths in ovsdb functional tests"