Remove device without master from DS. 30/56230/3
authorJozef Bacigal <jozef.bacigal@pantheon.tech>
Fri, 28 Apr 2017 07:42:15 +0000 (09:42 +0200)
committerJozef Bacigal <jozef.bacigal@pantheon.tech>
Thu, 4 May 2017 07:51:48 +0000 (09:51 +0200)
See also: Bug-6459

Change-Id: I6d27681b60a75df173a49742885c75c16d691b26
Signed-off-by: Jozef Bacigal <jozef.bacigal@pantheon.tech>
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) {