VOL-4189
rwcore - RPC update-flows-incrementally() triggered during reconciling

Change-Id: I91b260bdaf7401927c03eed08847c2d7b4112095
diff --git a/rw_core/core/device/agent_pm_config.go b/rw_core/core/device/agent_pm_config.go
index 2e355aa..176a126 100644
--- a/rw_core/core/device/agent_pm_config.go
+++ b/rw_core/core/device/agent_pm_config.go
@@ -32,6 +32,11 @@
 	logger.Debugw(ctx, "update-pm-configs", log.Fields{"device-id": pmConfigs.Id})
 
 	cloned := agent.cloneDeviceWithoutLock()
+
+	if !agent.proceedWithRequest(cloned) {
+		return status.Errorf(codes.FailedPrecondition, "deviceId:%s, Cannot complete operation as device deletion is in progress or reconciling is in progress/failed", cloned.Id)
+	}
+
 	cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
 
 	// Send the request to the adapter
@@ -95,6 +100,10 @@
 	logger.Debugw(ctx, "init-pm-configs", log.Fields{"device-id": pmConfigs.Id})
 
 	cloned := agent.cloneDeviceWithoutLock()
+
+	if !agent.proceedWithRequest(cloned) {
+		return status.Errorf(codes.FailedPrecondition, "deviceId:%s, Cannot complete operation as device deletion is in progress or reconciling is in progress/failed", cloned.Id)
+	}
 	cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
 	return agent.updateDeviceAndReleaseLock(ctx, cloned)
 }