Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • ACM-R receives message from participant intermediary that is restarted
  • if Participant is Oslo version (replicaId is not equal to participantId)
    • ACM-R sends restarting message to participant intermediary replica
    • Participant intermediary handles the restarting message (to save data in memory) and calls participantParticipant saves local data
  • if Participant is New Delhi version (replicaId is equals to participantId)
    • ACM-R set the restarting flag to true of all compositions/instances (user cannot do actions)
    • ACM-R sends restarting message to participant intermediary
    • Participant intermediary handles the restarting message (to save data in memory) and calls participant
    • Participant saves local data and does actions if the composition/instance was in priming/deploying/...,
    • Participant sends to ACM-R the final state
    • ACM-R receives message from participant about the final state and set restarting flag to null
    • Participant is Oslo version

...

Code Block
languagejava
titleAcElementListenerV2
    @Override
    public void handleRestartInstance(CompositionElementDto compositionElement, InstanceElementDto instanceElement,
                                      DeployState deployState, LockState lockState) throws PfModelException {

        if (DeployState.DEPLOYING.equals(deployState)) {
            deploy(compositionElement, instanceElement);
            return;
        }
        if (DeployState.UNDEPLOYING.equals(deployState)) {
            undeploy(compositionElement, instanceElement);
            return;
        }
        if (DeployState.UPDATING.equals(deployState)) {
            update(compositionElement, instanceElement, instanceElement);
            return;
        }
        if (DeployState.DELETING.equals(deployState)) {
            delete(compositionElement, instanceElement);
            return;
        }
        if (LockState.LOCKING.equals(lockState)) {
            lock(compositionElement, instanceElement);
            return;
        }
        if (LockState.UNLOCKING.equals(lockState)) {
            unlock(compositionElement, instanceElement);
            return;
        }
        intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(),
            instanceElement.elementId(), deployState, lockState, StateChangeResult.NO_ERROR, "Restarted");
    }


Refactored and will be never called:

Code Block
languagejava
titleAcElementListenerV2
    @Override
    public void handleRestartInstance(CompositionElementDto compositionElement, InstanceElementDto instanceElement,
                                      DeployState deployState, LockState lockState) throws PfModelException {
    }

Policy participant:

Code Block
languagejava
titleAutomationCompositionElementHandler
    @Override
    public void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element,
            Map<String, Object> properties, DeployState deployState, LockState lockState) throws PfModelException {
        if (DeployState.DEPLOYING.equals(deployState)) {
            deploy(automationCompositionId, element, properties);
            return;
        }
        if (DeployState.UNDEPLOYING.equals(deployState) || DeployState.DEPLOYED.equals(deployState)
                || DeployState.UPDATING.equals(deployState)) {
            var automationCompositionDefinition = element.getToscaServiceTemplateFragment();
            serviceTemplateMap.put(element.getId(), automationCompositionDefinition);
        }
        if (DeployState.UNDEPLOYING.equals(deployState)) {
            undeploy(automationCompositionId, element.getId());
            return;
        }
        deployState = AcmUtils.deployCompleted(deployState);
        lockState = AcmUtils.lockCompleted(deployState, lockState);
        intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
element.getId(), deployState,                 lockState, StateChangeResult.NO_ERROR, "Restarted");     }

Policy participant refactored:

Code Block
languagejava
titleAutomationCompositionElementHandler
    @Override     public void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element,             Map<String, Object> properties, DeployState deployState, LockState lockState) throws PfModelException {
         if (DeployState.DEPLOYING.equals(deployState) || DeployState.UNDEPLOYING.equals(deployState)
                || DeployState.DEPLOYED.equals(deployState) || DeployState.UPDATING.equals(deployState)) {
            var automationCompositionDefinition = element.getToscaServiceTemplateFragment();
            serviceTemplateMap.put(element.getId(), automationCompositionDefinition);
        }
        if (DeployState.DELETED.equals(deployState)) {
            serviceTemplateMap.remove(element.getId());
        }
    }