Fixes missing method in Hyper-V Utils (Metering)

Change-Id: I2beecfd13617fb243008016b810f49db5593fc65
Closes-Bug: 1252712
l3_agent: make process_router more robust

If internal_network_added/removed fails, _sync_routers_task will call
process_router to do fault recovery. Because the port is already
added/removed to/from ri.internal_ports, internal_network_added or
internal_network_removed will not be called again.

The patch fix this issue by calling ri.internal_ports.append/removed
only if internal_network_added/removed succeed. Without the patch,
the added testcases would fail.

Change-Id: I2d2e004caa670c1624257c1d7ccc900438b42d08
Co-Authored-By: Hirofumi Ichihara <ichihara.hirofumi@lab.ntt.co.jp>
Closes-Bug: #1255871
Fix str2dict and dict2str's incorrect behavior

Closes-bug: #1258065

Change-Id: Idf14c077eeeda6f18f534ad8f62cd741d0c0a2eb
Switch to using spawn to properly treat errors during sync_state

Changes f1b9ac5a and 9f6ff7e3 were aimed at improving the robustness
of the sync_state method. However both missed switching from spawn_n
to spawn to properly deal with raised exceptions.

Change-Id: Ieda4a5ecca63de67d8a9757962e7e3383fd9c9ea
Related-bug: #1257514
Remove dead code _arp_spoofing_rule()

This code should have been removed when the allowed_address_pair
extension was added here (0efce6195fa7be80e110bd841dc9b3537a94c376).
The arp spoofing rules are handled in the method _setup_spoof_filter_chain().

Reported by: Amir Sadoughi that this was crud I left behind :)

Change-Id: Ib0e2e2a5c13fb8fa7af1f988510143f40ac335e2
Closes-bug: #1258629
Imported Translations from Transifex

Change-Id: I8899e6ade1eb38e6d183cb35a509fcbecdc04b47
Add LeastRouters Scheduler to Neutron L3 Agent

Allow scheduling of a virtual router on an L3 Agent node with the least
number of routers currently scheduled. This scheduler can be used
instead of the default random scheduler.

Also refactor the l3_agent_scheduler to allow for adding new schedulers.

Implement blueprint lessrouter-scheduler
Change-Id: Ie539c08bdc8a6e1430a106f77d08f15abd0903e7
Merge "Remove dead code _arp_spoofing_rule()"
Merge "l3_agent: make process_router more robust"
Fix a race condition in agents status update code

Code handling agents status updates coming via RPC checks,
if a corresponding entry for the given (agent_type, host)
pair already exists in DB and updates it. And if it doesn't
exist, a new entry is created.

Without a unique constraint this can cause a race condition
resulting in adding of two agent entries having the same value
of (agent_type, host) pair.

Note, that it's already not allowed to have multiple agents of
the same type having the same host value, but currently it's
enforced only at code level, not at DB schema level, which
effectively makes race conditions possible.

Closes-Bug: #1254246

Change-Id: I1ebaa111154b3d6b34074705b579097ab730594c
Merge "Add LeastRouters Scheduler to Neutron L3 Agent"
Remove root_helper config from plugin ini

As root_helper is defined in neutron.conf, root_helper in plugin ini
is unnecessary and brings confusion when configuring the parameter.
This patch updates plugin ini of NEC plugin and Brocade plugin.

Change-Id: I5b1c36d8d6ffc20ae0b4191a73aaa51f2b3d9a1b
Closes-Bug: #1259242
Merge "Imported Translations from Transifex"
Merge "Remove root_helper config from plugin ini"
Add post-mortem debug option for tests

Post-mortem debugging, the ability to drop into a debugger with the
execution state that triggered the exception, is very useful in
diagnosing failure conditions.  Our previous test runner, nose,
provided the ability to enable post-mortem debugging on test
failures (via --pdb-failure) and errors (via --pdb).  testr
lacks these options at present, so this change adds support
for enabling post-mortem debugging via an environment variable.
All test-triggered exceptions will result in a post-mortem debugger
being invoked if OS_POST_MORTEM_DEBUG is set to "1" or "True".

Implements: blueprint neutron-pm-debug-on-test-failure
Change-Id: Iddbe1335b059d062c0286df2ad27aef7728461b7
Imported Translations from Transifex

Change-Id: Ic0303173cb8a04bc9bb2e31b80e37baca538dc9b
change variable name from plugin into agent

Variable for agent instance should be named as 'agent'
instead of plugin.

Change-Id: I9bb2245049c6d6084284c2311a4c6aa2ad880bc1
Closes-Bug: #1259431
LBaaS: unify haproxy-on-host plugin driver and agent

Unifies haproxy reference implementation to make common agent based plugin driver
which is suitable for all vendors who wants to use async mechanism.

 - Agent API as well as device driver API changed to handle
   loadbalancer objects individually;
 - Agent loads device drivers according to config;
 - LogicalDeviceCache class was removed from agent as it was used only
   as a list - to put and remove entries ant check whether entry is in or not.
   It was replaced with instance_mapping dict in agent to store known instances and
   corresponding device_drivers;
 - Agent reports which device drivers are supported (needs for scheduling on plugin side);
 - Agent-to-plugin API was extended to provide an ability for agent to update
   statuses of pools/vips/members/health_monitors;
 - Vendor should only implement device driver; plugin driver just needs
   to inherit AgentBasedPluginDriver and override device_driver member;
 - This patch doesn't move files to make review easier;
   all rename/replace will be done in a subsequent patch;

DocImpact

NOTE: Since the change in the agent RPC API is backward-incompatible
(major RPC version change), LBaaS server-agent communications will be
completely broken until both sides are upgraded so users will be unable to
create new or update existing HAProxy loadbalancer instances during upgrade

Implements blueprint lbaas-common-agent-driver

Change-Id: I9fd90a1321611d202ef838681273081fa6c1686a
Merge "Imported Translations from Transifex"
Merge "Fix str2dict and dict2str's incorrect behavior"