Committed by
Gerrit Code Review
CORD-280 Fix the way to add and remove a node to consistent store
Change-Id: Iff55398d0a78acf3cdce8a5b43146f95b562d5a5
Showing
1 changed file
with
1 additions
and
7 deletions
... | @@ -146,9 +146,7 @@ public class CordVtn implements CordVtnService { | ... | @@ -146,9 +146,7 @@ public class CordVtn implements CordVtnService { |
146 | public void addNode(OvsdbNode ovsdb) { | 146 | public void addNode(OvsdbNode ovsdb) { |
147 | checkNotNull(ovsdb); | 147 | checkNotNull(ovsdb); |
148 | 148 | ||
149 | - if (!nodeStore.containsKey(ovsdb.deviceId())) { | 149 | + nodeStore.putIfAbsent(ovsdb.deviceId(), ovsdb); |
150 | - nodeStore.put(ovsdb.deviceId(), ovsdb); | ||
151 | - } | ||
152 | 150 | ||
153 | if (isNodeConnected(ovsdb)) { | 151 | if (isNodeConnected(ovsdb)) { |
154 | init(ovsdb); | 152 | init(ovsdb); |
... | @@ -161,10 +159,6 @@ public class CordVtn implements CordVtnService { | ... | @@ -161,10 +159,6 @@ public class CordVtn implements CordVtnService { |
161 | public void deleteNode(OvsdbNode ovsdb) { | 159 | public void deleteNode(OvsdbNode ovsdb) { |
162 | checkNotNull(ovsdb); | 160 | checkNotNull(ovsdb); |
163 | 161 | ||
164 | - if (!nodeStore.containsKey(ovsdb.deviceId())) { | ||
165 | - return; | ||
166 | - } | ||
167 | - | ||
168 | if (deviceService.getDevice(ovsdb.deviceId()) != null) { | 162 | if (deviceService.getDevice(ovsdb.deviceId()) != null) { |
169 | if (deviceService.isAvailable(ovsdb.deviceId())) { | 163 | if (deviceService.isAvailable(ovsdb.deviceId())) { |
170 | log.warn("Cannot delete connected node {}", ovsdb.host()); | 164 | log.warn("Cannot delete connected node {}", ovsdb.host()); | ... | ... |
-
Please register or login to post a comment