NSX: replace strong references to the plugin with weakref ones

This is done in accordance to a refactoring done in change 92793.

Partial-bug: #1234857

Change-Id: Iaf2bc93182c01e62bb755b4e3f104f5a926b73fc
Make linux.utils.execute log error on return codes

Previously, the execute method in neutron logs everything as debug which hides
a lot of extremely fatal errors like unable to apply security group rules!
This patch changes this code so that we log all non 0 returns as error.

Change-Id: I7328e62269212ccd9c7950ff064a3e337de56918
Closes-bug: 1323832
Related-bug: 1322945
Sync periodic_task from oslo-incubator

This is more or less to get commit c63fd5a from oslo into the core
projects which have several periodic tasks.  Neutron has periodic tasks
for L3, load balancing and metering agents to sync up state with the
server and most don't have specific spacing values set which can lead to
non-deterministic spacing of when the tasks run.

Note that this does not include the gettextutils and log dependencies
since there are not functional changes in those modules needed for the
periodic_task changes synced in *and* more importantly, the changes
to gettextutils and log require pervasive changes to neutron which
should happen when neutron integrates with the oslo-i18n library for
blueprint i18n--messages.

Further note that this does not include jsonutils due to some
issues introduced with a change for python 2.6 that impacts how strings
are encoded with simplejson. The details for that issue are in bug
1314129.  The jsonutils changes are not related to the periodic_task
changes being synced in so the dependency is not functionally required.

The LbaasAgentManager extends PeriodicTasks but wasn't calling the
parent class init function, which was causing failures since commit
47c9d60 changed PeriodicTasks to init _periodic_last_run, so also
fixed that here.

Changes:

c63fd5a Make unspecified periodic spaced tasks run on default interval
f0dd798 Remove rendundant parentheses of cfg help strings
fcf517d Update oslo log messages with translation domains
051b9f3 Refactor unnecessary arithmetic ops in periodic_task
674cdaf Refactor if logic in periodic_task
b6b82c5 Use timestamp in periodic tasks
47c9d60 Don't share periodic_task instance data in a class attr
8b2b0b7 Use hacking import_exceptions for gettextutils._

Related-Bug: #1319232

Change-Id: Ib23e33326129be0dd952efde263f381d5aa2457f
Handle errors from run_ofctl() when dumping flows

The function dump_flows_for_table() calls run_ofctl(). If this occurs during an OVS
restart, run_ofctl() will return None. dump_flows_for_table() needs to realize this
and not try to call splitlines() on a None object.

Change-Id: Ide26028656e634113f955dfc89569149d4d5b306
Closes-Bug: #1324659
Remove unnecessary MagicMocks in cisco unit tests

Two patches that just return static data never have
assertions made on the MagicMocks generated. This
replaces the magicmocks with lambdas to make the code
easier to read and to get a minor performance gain.

Change-Id: I064c57a66a0f7a8e3080f39cf48bd4b67cf304e3
Partial-Bug: #1316401
Remove function replacement with mock patch

In the hyperv unit tests, an rpc method is
manually replaced with a MagicMock using setattr.
This prevents it from being cleaned up by mock.patch.stopall.
This patch replaces it with a short-lived patch call
in a with statement.

Change-Id: I7b10a8115c474977e3acd16dc49d6f3ae67b0c3b
Partial-Bug: #1316401
Merge "Sync periodic_task from oslo-incubator"
Merge "Handle errors from run_ofctl() when dumping flows"
Merge "Make linux.utils.execute log error on return codes"
Merge "NSX: replace strong references to the plugin with weakref ones"
Merge "Remove unnecessary MagicMocks in cisco unit tests"
Merge "Remove function replacement with mock patch"