Fix exception in addSwitch 78/74378/2
authorSridhar Gaddam <sgaddam@redhat.com>
Tue, 24 Jul 2018 08:33:36 +0000 (14:03 +0530)
committerSam Hague <shague@redhat.com>
Tue, 24 Jul 2018 18:28:13 +0000 (18:28 +0000)
commit121e544372a5b39f436e6aab10ee1701c1b5dad3
tree6ba1327a3b7dac203d0e1f154a9dc411ad475d30
parent8012312fab51684cba402bc2544db6557534fe3f
Fix exception in addSwitch

In a fresh deployment when the first switch is
added to the controller and when there are no
neutron resources (like ExtRouters) are present,
the current implementation in addSwitch was
causing ExpectedDataObjectNotFoundException.
This patch fixes it by changing the syncRead
to syncReadOptional while querying the datastore.

Issue: NETVIRT-1382

Change-Id: I4393a7ad2fa896eda2e1cbb88e3c34c9ffcc0c56
Signed-off-by: Sridhar Gaddam <sgaddam@redhat.com>
(cherry picked from commit acb65d76fce6e6a361fd59a72fe33f067f3d27c1)
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/ha/WeightedCentralizedSwitchScheduler.java