Add retry decorator update_segment_host_mapping()
Add retry decorator update_segment_host_mapping()

When multiple agents register at the same time there is
a possible race condition causing segment host mappings
updates to fail. StaleDataError raised by SQLAlchemy ORM.

Adding retry_if_session_inactive() decorator to the method
fixes the issue.

Also serialize the method with lockutils. It takes 25+
seconds to update segment host mappings for 10 agents with
the retry decorator alone. With the method serialized the
same operation completes in less than 1 second. The retry
decorator is still required for active/active scenarios.

Closes-Bug: #1743579
Change-Id: I616457f094d000a4016c610b454be8269d9b4948

huntxu/neutron,openstack/neutron,huntxu/neutron,mahak/neutron,mahak/neutron,mahak/neutron,openstack/neutron,openstack/neutron,noironetworks/neutron,noironetworks/neutron