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)
fix --excluded of meter-label-rule-create is not working

rule['excluded'] is boolean type, should not be compared with 'true'

Closes-Bug: #1248002
Change-Id: Ie78c307ede1f7124c58354825a411474ff6c1234
(cherry picked from commit 504f496d6b4fd6234c3e65ba636ee12b004fae1f)
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)
Fix metering iptables driver doesn't read root_helper param

With this patch the iptables driver instantiates the
iptables_manager with the correct root_helper value.

Change-Id: I9a37bae92dc12a8a78ea2d1b9fc5e995321ca322
Closes-bug: #1256036
(cherry picked from commit 35f64f8026f7607c749727ac6b3ee93c956bdfd2)
[ML2] l2-pop MD handle multi create/delete ports

If more than one port is added or removed simultaneously, port db entry
have status BUILD or DOWN and pass to ACTIVE when agent have finish to
configured it.
l2-pop mechanism driver use events port pass to ACTIVE or DOWN to send
fdb entries. In case of port is the first or the last network port on
an agent, the flooding entry need to be add or removed.

This patch fix the method to determine how many ports are active on a
agent by adding filter on status port to be ACTIVE.

Closes-bug: #1263881
(cherry picked from commit 7e91362dbb974df5ee44d346e1d0971479510d4b)

Change-Id: Id6d7273376cbb7c31aa058f80eee9dab12ffa900
Have tox install via setup.py develop

tox 1.6 was released, which means that we can now take advantage of
the feature we added to it - which is using setup.py develop to
install the code into the virtualenv. The logic was taken from
run_tests.sh - so the performance issues around using tox vs. using
install_venv should now be gone.

Additionally, override the tox pip install command to avoid using
the "--pre" option which is the default in tox. "--pre" means
"Include pre-release and development versions." By default, pip will
only install stable versions of software, and that is the behavior
we want.

Change-Id: Ida5e440d1bdb9f8e9031277ea53a02d2ef171438
Co-Authored-By: Monty Taylor <mordred@inaugust.com>
Bump stable/havana next version to 2013.2.3

Change-Id: Ia5b940faf01df6cae58df1f4b4f5e8fa2f3f078a
Tweak version nvp/nsx version validation logic for router operations

This patch improves how the nsx/nvp controller version is validated
prior to some router operations. This is done by greatly simplifying
the boolean condition.

Missing unit tests are also added for increased coverage.

Closes-bug: 1274361

Change-Id: I1b21444fd86b6e6a0c72bb5a43f1707934dd70e4
(cherry picked from commit f055df48bf7a605463b28b66f5197f1275fb6948)
Fix error while connecting to busy NSX L2 Gateway

Ensure that a Conflict error is properly handled.

Change-Id: Ib468ee953aef0fc54ea88064f88637ed46bc6352
Closes-bug: 1270724
(cherry picked from commit 7ee1344c474b73dd2236d2c79df8dcf49cdb7bef)
Merge "Have tox install via setup.py develop" into stable/havana
Fix request timeout errors during calls to NSX controller

Sometimes two correlated exception traces are observed in
the server log for the Neutron Server backed by NSX:
RequestTimeout (The nsx request has timed out) and
OperationalError (Lock wait timeout exceeded). This is
generally described by Guru Salvatore Orlando as the,
and I quote, the "infamous eventlet-mysql deadlock".

This patch tries to address the issue by adding a
cooperative yield in the nsx client code (it’s a good idea
to call sleep(0) occasionally in any case) and also by
avoiding the unnecessary spawning of another Greenthread
within a call that is already executed in Greenthred
itself.

Closes-bug: #1267101
Related-bug: #1279497

Change-Id: I8e298468fb730f11a66fbd4211121ee7d3e2a548
(cherry picked from commit 85ddbde058d8bda0b938eb7a45ef73519a831b3b)
Merge "Fix error while connecting to busy NSX L2 Gateway" into stable/havana
vshield task manager: abort tasks in stop() on termination

This patch kills the manager thread, and aborts active tasks
rather than sending an exception to the manager thread and
have it do the abort on termination.

Unit tests involving vshield task manager might take longer
as a side effect of this patch.

Related-bug: #1282452

Conflicts:

        neutron/tests/unit/nicira/test_vcns_driver.py

Change-Id: I9e9e41ce7e8969a2ea51bfce96b1303125a24308
(cherry picked from commit 433287b4f51e45fbb7a73f68dd63b433ea5d9066)
Merge "Tweak version nvp/nsx version validation logic for router operations" into stable/havana
Merge "Bump stable/havana next version to 2013.2.3" into stable/havana
Remove the warning for Scheduling Network

when a new port is created, the schedule_network in agentschedulers_db is called.
Since this network may already be hosted, it will directly return None in dhcp_agent_scheduler,
which cause the agentschedulers_db.schedule_network log a warning message.

This is really annoying and making users confused.
And, real warnings are already addressed in the real scheduler function.
which is neutron.scheduler.dhcp_agent_scheduler.ChanceScheduler.schedule by default.

Cherry-picked from 3ef877fc5a669659c2fa4bb2fc416d4a473c6ac5 in master.

Change-Id: I11bdbe47c2cc0fc45fb143970fb6762678bc27e5
Closes-Bug: #1192786
Update help message of flag 'enable_isolated_metadata'

Thanks to the commit c73b54e50b62c489f04432bdbc5bee678b18226e,
the way of DHCP agent determines how a subnet is isolated evolves.
But the flag help message wasn't updtated accordingly to this evolution.

Depends on https://review.openstack.org/#/c/77118/ getting merged.

Change-Id: If07d8e0802524f9babdee0c8cc07d40cb0803afb
Closes-bug: #1269722
(cherry-picked from 6dd1a370fe2ece809c06202c04a7d230a74fa91a on master)
Merge "vshield task manager: abort tasks in stop() on termination" into stable/havana
Merge "Fix request timeout errors during calls to NSX controller" into stable/havana
Merge "Fix metering iptables driver doesn't read root_helper param" into stable/havana