From 4de641748dd2af9acafa689dbbbce96f29bca2a4 Mon Sep 17 00:00:00 2001 From: Oleksii Mozghovyi Date: Wed, 24 Feb 2021 23:41:34 +0200 Subject: [PATCH] Fix permanent lock on the running configuration via RESTconf This resolves the issue when the NETCONF device with both :writable-running and :candidate capabilities gets permanently locked after the commit happens via RESTconf. JIRA: NETCONF-705 Change-Id: I90c6ec104a9309dd25fc66cd74f469c2f033ee5f Signed-off-by: Oleksii Mozghovyi --- .../connect/netconf/sal/AbstractNetconfDataTreeService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractNetconfDataTreeService.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractNetconfDataTreeService.java index de820bacdc..771f29e6ce 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractNetconfDataTreeService.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractNetconfDataTreeService.java @@ -91,13 +91,12 @@ public abstract class AbstractNetconfDataTreeService implements NetconfDataTreeS Futures.addCallback(result, new FutureCallback<>() { @Override public void onSuccess(final RpcResult result) { - unlock(); + // do nothing, as callback is only used to catch failures } @Override public void onFailure(final Throwable throwable) { discardChanges(); - unlock(); } }, MoreExecutors.directExecutor()); return result; @@ -329,11 +328,13 @@ public abstract class AbstractNetconfDataTreeService implements NetconfDataTreeS errors.toArray(new RpcError[errors.size()]))); return; } + unlock(); resultFuture.set(CommitInfo.empty()); } @Override public void onFailure(final Throwable failure) { + unlock(); resultFuture.setException(new TransactionCommitFailedException( String.format("Commit of transaction %s failed", this), failure)); } -- 2.36.6