Hash device_id only if it is longer than the allowed MAX size for NVP

This ensure that a VM uuid stays untouched, avoiding potential
confusion when inspecting NVP port tags. This patch also abstracts
the hashing method out by introducing a device_id_to_vm_id method.
Filtering logic is preserved, and a test has been added to ensure
that. However such a logic is not currently used in the NeutronPlugin
(because of the introduction of async status updates), but it has
been added as utility method to nvplib.

Fixes bug #1215204

Change-Id: Ib96ecae438e30f195c8b45176abc1cf55b4b363f
Fix incorrect NotImplementedError

neutron.common.exceptions doesn't define NotImplementedError, but
some codes still use it. We should use builtin
exceptions.NotImplementedError instead.

Note: this patch also fixes a never run code in nvp.

Closes-Bug: #1221500
Change-Id: I5f367ab5edc1e7fbbc2e4eba5fe36d148d4d062d
Change daemon Pidfile class to not use root_helper

Some users of the Pidfile class don't specify root_helper,
which then defaults to 'sudo', which will generate an error.
Remove root_helper altogether since we actually don't need
root priveleges to read /proc/$pid/cmdline.

Changed code to use open.readline() instead of a shell, and
tweaked tests accordingly.

Also cleaned-up the rootwrap filters that allow it as they
are not used anymore.

Fixes bug 1218142

Change-Id: I6691feb1c9f7bfa261a7ec464fd8f3f92168c302
Fix ovs_lib's issue of parsing flow proto field

When 'proto' other than 'ip' and nw_src/nw_dst are provided at the same
time, the proto parameter will be ignored.

Fixes bug: 1223668

Change-Id: Ie813e66995e2a9310ec4b48c0f7de673db2097f1
Don't add neutron metadata_nat_rules if disable metadata proxy

This patchset fixes this issue by adding a condition when adding nat
rules of neutron metadata proxy.

fixes bug #1212168

Change-Id: I99775aad73c49a8df3043690440d214614279a2b
Don't need to init testr in run_tests.sh

In run_tests.sh, function init_testr will initialize testr if the
directory .testrepository is not existed. Actually, testr will do
the check before run the test:

In Python package testrepository, setuptools_command.py:Testr.run

68 def run(self):
69     """Set up testr repo, then run testr"""
70     if not os.path.isdir(".testrepository"):
71         self._run_testr("init")

So, init_testr can be removed safely.

Fixes Bug #1224285

Change-Id: Ia74d9fff92b8efba9b72e5c7387f761144daa193
Prevent update_port ip_address from matching address_pair

Previously one could update a port to match one of the address_pairs.
This patch prevents that.

Fixes bug: 1223646

Change-Id: Ic8cecfdb83b3fd9d2691bb41e0427cf578577fc8
Avoid performing extra query for fetching qos bindings

Bug 1215872

Add a relationship with eager loading in the Port and Network models,
thus preventing the 'extend' functions from performing extra queries.
This patch also slight alters the methods for processing qos_queue
bindings in order to allow them for populating the qos_queue id in
the response being created.

Change-Id: Ie80d12aeed5de94afa61f23d7bcfc21372f23c4f
Clean up code of virt_phy_sw_v2 module

 Removes two methods not used:
 * _get_all_segmentation_ids
 * _validate_vlan_id

 About log formatting:
 * In the __init__, '\n' can be removed from this line:
     LOG.debug(_("Loaded device plugin %s\n"),

Closes-Bug: 1180783

Change-Id: Ic0aea7e8016f198e2ba245c710e12bc490720039
Fix LinuxBridge test name from Openvswitch

Fixes bug: 1224598

Change-Id: I791108f39e5fc7fcd9532b29d4b117d47907261c
Fixed typo defult_tz_uuid

Fixes bug: 1224038

Change-Id: I0a4c7a63fefc02c4b8ae52d61fd036be8d375351
Fix error code for deletion of router which is in use by vpnservice

In this commit, we check router is in use by a vpnservice or not when
we delete router.

Fixes bug 1224174

Change-Id: I55a4b9b93715fbb36816c69729d88eb494bcf15e
Enhance exception translation to better handle NeutronExceptions

NeutronExceptions have a 'message' class attribute that holds the
generic error message template, e.g. "Network %(network)s not found",
unfortunately, because the names are the same, it was overshadowing the
actual exception instance 'message', e.g. "Network 1 not found", after
translation when the exception was serialized to JSON.

This patch puts the exception's actual message in a new field called
'msg' and overwrites NeutronException unicode() so that 'msg' is used
during serialization and we'll get the correct message on the REST API
response.

Fixes bug: #1212882

Change-Id: I3965bffb1c2c2eee0af440d1ecd30ccb3bb958d5
pass default l3_gateway_service_uuid if not specified

Previously, if one created an external network of type l3_ext and did
not specify the default_gw_service_uuid via --provider:physical_network
an exception would be raised on the backend as we need to specify the
l3_gw_service_uuid we want nvp to use.

Fixes bug: 1224660

Change-Id: I6312956528c17d6a704d4e4ef629916f6463312a
Add (useful) missing headlines to nvp unit test files

For Aaron Rosen's amusement, even though slightly ashamed.

Change-Id: Idadb7a86dddb2523987852179ebe23f6272846fb
Merge "Fix LinuxBridge test name from Openvswitch"
Merge "Add (useful) missing headlines to nvp unit test files"
Merge "Clean up code of virt_phy_sw_v2 module"
Merge "Avoid performing extra query for fetching qos bindings"
Merge "pass default l3_gateway_service_uuid if not specified"