aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2024-11-28 14:54:21 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2024-12-04 10:28:02 +0000
commit4e99849bef97bdc98f96fd62668ab4f83aa25c7a (patch)
treeade5172ba9490621985b0b4248b4ef01a47f620c /models
parentcd58a583081acf3cbfa6caa3b59143a7b6e7669c (diff)
Fix validation in ACM-runtime
Fix validation after migration fail and undeploy fail in ACM-runtime. Add more information in fail validation. Issue-ID: POLICY-5195 Change-Id: I870fd31b59bb65db8cb6e8e1b9ee502fc3d63743 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java44
1 files changed, 24 insertions, 20 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
index 9239b3ae9..09f1b09cd 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
@@ -100,19 +100,12 @@ public class AcInstanceStateResolver {
DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, MIGRATE_PRECHECK);
// make an order in a failed scenario
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
- UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, DEPLOY);
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
- DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, DEPLOY);
-
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
- UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, UNDEPLOY);
+ setAllowed(DEPLOY);
+ setAllowed(UNDEPLOY);
this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
UPDATING, LOCKED, SUB_STATE_NONE, FAILED}, UNDEPLOY);
this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
MIGRATING, LOCKED, SUB_STATE_NONE, FAILED}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
- DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, UNDEPLOY);
this.graph.put(new String[] {DELETE, LOCK_NONE, SUB_NONE,
DELETING, LOCK_NONE, SUB_STATE_NONE, FAILED}, DELETE);
@@ -131,23 +124,12 @@ public class AcInstanceStateResolver {
DEPLOYED, LOCKED, MIGRATION_PRECHECKING, FAILED}, MIGRATE_PRECHECK);
// timeout
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
- UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, DEPLOY);
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
- DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, DEPLOY);
-
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
- UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
- UNDEPLOYING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
UPDATING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
MIGRATING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
MIGRATION_PRECHECKING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
- DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
this.graph.put(new String[] {DELETE, LOCK_NONE, SUB_NONE,
DELETING, LOCK_NONE, SUB_STATE_NONE, TIMEOUT}, DELETE);
@@ -168,6 +150,28 @@ public class AcInstanceStateResolver {
DEPLOYED, LOCKED, MIGRATION_PRECHECKING, TIMEOUT}, MIGRATE_PRECHECK);
}
+ private void setAllowed(String deployOrder) {
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, deployOrder);
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, LOCKED, SUB_STATE_NONE, FAILED}, deployOrder);
+
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, deployOrder);
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, LOCKED, SUB_STATE_NONE, TIMEOUT}, deployOrder);
+
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, deployOrder);
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ DEPLOYING, LOCKED, SUB_STATE_NONE, FAILED}, deployOrder);
+
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, deployOrder);
+ this.graph.put(new String[] {deployOrder, LOCK_NONE, SUB_NONE,
+ DEPLOYING, LOCKED, SUB_STATE_NONE, TIMEOUT}, deployOrder);
+ }
+
/**
* Check if Deploy Order and Lock Order are consistent with current DeployState and LockState.
*