From 90299c25f28265e0327898b60029a8088a4b0aad Mon Sep 17 00:00:00 2001 From: Jozef Bacigal Date: Fri, 28 Apr 2017 09:42:15 +0200 Subject: [PATCH] Remove device without master from DS. See also: Bug-6459 Change-Id: I6d27681b60a75df173a49742885c75c16d691b26 Signed-off-by: Jozef Bacigal --- .../impl/lifecycle/ContextChainHolderImpl.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImpl.java index 5e77567394..2e52dc214e 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImpl.java @@ -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) { -- 2.36.6