[VOL-4514] Addressing device reconciliation failure
See comments on https://jira.opencord.org/browse/VOL-4514
This change is dependent on the related proto and voltha lib go
changes to be merged first. Until then jenkins will fail.
Change-Id: I8d99c3619d630677d402b9fb4b4f0bc22dd9a9f0
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 1adf88c..2c69b28 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -1367,11 +1367,15 @@
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
return err
}
+ logger.Infow(ctx, "aborting-current-running-requests-after-wait", log.Fields{"device-id": agent.deviceID})
+
defer agent.requestQueue.RequestComplete()
// If any reconciling is in progress just abort it. The adapter is gone.
agent.stopReconcile()
+ logger.Infow(ctx, "aborting-current-running-requests-after-sendstop", log.Fields{"device-id": agent.deviceID})
+
// Update the Core device transient state accordingly
var updatedState core.DeviceTransientState_Types
switch agent.getTransientState() {
@@ -1515,7 +1519,7 @@
//making here to keep lifecycle of this channel within the scope of retryReconcile
agent.stopReconcilingMutex.Lock()
- agent.stopReconciling = make(chan int)
+ agent.stopReconciling = make(chan int, 1)
agent.stopReconcilingMutex.Unlock()
// defined outside the retry loop so it can be cleaned
@@ -1591,6 +1595,8 @@
break retry
}
+ logger.Debugw(ctx, "reconcile-retry-ends", log.Fields{"adapter-endpoint": agent.adapterEndpoint})
+
// Retry loop is broken, so stop any timers and drain the channel
if backoffTimer != nil && !backoffTimer.Stop() {
diff --git a/rw_core/core/device/agent_test.go b/rw_core/core/device/agent_test.go
index 5cc1f26..354f306 100755
--- a/rw_core/core/device/agent_test.go
+++ b/rw_core/core/device/agent_test.go
@@ -131,7 +131,7 @@
LivenessChannelInterval: cfg.LiveProbeInterval / 2}
proxy := model.NewDBPath(backend)
- dat.adapterMgr = adapter.NewAdapterManager(proxy, dat.coreInstanceID, backend, 5)
+ dat.adapterMgr = adapter.NewAdapterManager("test-endpoint", proxy, dat.coreInstanceID, backend, 5)
eventProxy := events.NewEventProxy(events.MsgClient(dat.kEventClient), events.MsgTopic(kafka.Topic{Name: cfg.EventTopic}))
dat.deviceMgr, dat.logicalDeviceMgr = NewManagers(proxy, dat.adapterMgr, cfg, dat.coreInstanceID, eventProxy)
dat.adapterMgr.Start(context.Background(), "agent-test")
diff --git a/rw_core/core/device/logical_agent_test.go b/rw_core/core/device/logical_agent_test.go
index e611019..19ed77c 100644
--- a/rw_core/core/device/logical_agent_test.go
+++ b/rw_core/core/device/logical_agent_test.go
@@ -154,7 +154,7 @@
LivenessChannelInterval: cfg.LiveProbeInterval / 2}
proxy := model.NewDBPath(backend)
- adapterMgr := adapter.NewAdapterManager(proxy, lda.coreInstanceID, backend, 5)
+ adapterMgr := adapter.NewAdapterManager("test-endpoint", proxy, lda.coreInstanceID, backend, 5)
eventProxy := events.NewEventProxy(events.MsgClient(lda.kEventClient), events.MsgTopic(kafka.Topic{Name: cfg.EventTopic}))
lda.deviceMgr, lda.logicalDeviceMgr = NewManagers(proxy, adapterMgr, cfg, lda.coreInstanceID, eventProxy)
adapterMgr.Start(context.Background(), "logical-test")
diff --git a/rw_core/core/device/manager_sbi.go b/rw_core/core/device/manager_sbi.go
index b518b2a..dcf6599 100644
--- a/rw_core/core/device/manager_sbi.go
+++ b/rw_core/core/device/manager_sbi.go
@@ -23,11 +23,17 @@
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"github.com/opencord/voltha-protos/v5/go/common"
ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
+ "github.com/opencord/voltha-protos/v5/go/health"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
+func (dMgr *Manager) GetHealthStatus(ctx context.Context, clientConn *common.Connection) (*health.HealthStatus, error) {
+ logger.Debugw(ctx, "get-health-status-from-remote", log.Fields{"remote-client": clientConn})
+ return &health.HealthStatus{State: health.HealthStatus_HEALTHY}, nil
+}
+
func (dMgr *Manager) PortCreated(ctx context.Context, port *voltha.Port) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "PortCreated")