VOL-3492 panic in rw-core.
error log, in case of agent.start() failure, uses nil reference of childDevice.
Change-Id: Ib6ab65b7a0ad6e8356f16f2977d72e0daf080816
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 3b98cf8..345255f 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -1045,7 +1045,7 @@
// Create and start a device agent for that device
agent := newAgent(dMgr.adapterProxy, childDevice, dMgr, dMgr.dbPath, dMgr.dProxy, dMgr.defaultTimeout)
- childDevice, err := agent.start(ctx, childDevice)
+ insertedChildDevice, err := agent.start(ctx, childDevice)
if err != nil {
logger.Errorw(ctx, "error-starting-child-device", log.Fields{"parent-device-id": childDevice.ParentId, "child-device-id": agent.deviceID, "error": err})
return nil, err
@@ -1062,7 +1062,7 @@
}()
}
- return childDevice, nil
+ return insertedChildDevice, nil
}
func (dMgr *Manager) packetOut(ctx context.Context, deviceID string, outPort uint32, packet *ofp.OfpPacketOut) error {