Remove device without master from DS.
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / lifecycle / ContextChainHolderImpl.java
index 5e77567394ecca36e6a8fe8360c9307d224f5dc6..2e52dc214ec823b4a1f45fccf39c77fc018a3e8e 100644 (file)
@@ -328,13 +328,13 @@ public class ContextChainHolderImpl implements ContextChainHolder {
 
     @Override
     public void ownershipChanged(EntityOwnershipChange entityOwnershipChange) {
-        if (!entityOwnershipChange.hasOwner() && !entityOwnershipChange.isOwner() && entityOwnershipChange.wasOwner()) {
+        if (!entityOwnershipChange.hasOwner()) {
             final YangInstanceIdentifier yii = entityOwnershipChange.getEntity().getId();
             final YangInstanceIdentifier.NodeIdentifierWithPredicates niiwp =
                     (YangInstanceIdentifier.NodeIdentifierWithPredicates) yii.getLastPathArgument();
             String entityName =  niiwp.getKeyValues().values().iterator().next().toString();
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Last master for entity : {}", entityName);
+                LOG.debug("Entity {} has no owner", entityName);
             }
 
             if (entityName != null ){
@@ -344,7 +344,7 @@ public class ContextChainHolderImpl implements ContextChainHolder {
                     if (entry.getKey().getNodeId().equals(nodeId)) {
                         inMap = entry.getKey();
                         break;
-                    }                    
+                    }
                 }
                 if (Objects.nonNull(inMap)) {
                     markToBeRemoved.add(inMap);
@@ -355,11 +355,12 @@ public class ContextChainHolderImpl implements ContextChainHolder {
                                 .removeDeviceFromOperationalDS(DeviceStateUtil.createNodeInstanceIdentifier(nodeId))
                                 .checkedGet(5L, TimeUnit.SECONDS);
                     } catch (TimeoutException | TransactionCommitFailedException e) {
-                        LOG.warn("Not able to remove device {} from DS", nodeId);
+                        LOG.info("Not able to remove device {} from DS. Probably removed by another cluster node.",
+                                nodeId);
                     }
                 }
-            }                
-        }        
+            }
+        }
     }
 
     private void sendNotificationNodeAdded(final DeviceInfo deviceInfo) {