aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-03-10 14:54:10 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-10 14:54:10 +0000
commit43fc1ee27456a17668e5f3f424a0bc6b7973e6e8 (patch)
treee867127dae70e6f698938a33585b2bc117963859 /adapters/mso-adapter-utils
parent4dc7f5c75956c68223003ad10670ef47bdad6e26 (diff)
parent7b42dee721e03ee3f0a52dda92010e09d748cf72 (diff)
Merge "false positive on network creates"
Diffstat (limited to 'adapters/mso-adapter-utils')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 62b9c04e3f..8207c7c589 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -101,8 +101,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private static final String CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS";
- private static final String DELETE_STACK = "DeleteStack";
-
protected static final String HEAT_ERROR = "HeatError";
protected static final String CREATE_STACK = "CreateStack";
@@ -115,14 +113,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private Environment environment;
@Autowired
- RequestsDbClient requestDBClient;
-
- @Autowired
StackStatusHandler statusHandler;
@Autowired
NovaClientImpl novaClient;
+ @Autowired
+ RequestsDbClient requestDBClient;
+
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
// Properties names and variables (with default values)
@@ -182,6 +180,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
CreateStackParam createStack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes,
environment, nestedTemplates, heatFiles);
Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
+ boolean operationPerformed = false;
if (currentStack != null) {
logger.debug("Existing Stack found with Status: {} ", currentStack.getStackStatus());
if (CREATE_COMPLETE.equals(currentStack.getStackStatus())) {
@@ -220,8 +219,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
currentStack =
queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
}
+ operationPerformed = true;
}
- return new StackInfoMapper(currentStack).map();
+ StackInfo stackInfo = new StackInfoMapper(currentStack).map();
+ stackInfo.setOperationPerformed(operationPerformed);
+ return stackInfo;
}
/**
@@ -497,14 +499,17 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName,
boolean pollForCompletion, int timeoutMinutes) throws MsoException {
Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
+ StackInfo stackInfo = null;
if (currentStack == null || DELETE_COMPLETE.equals(currentStack.getStackStatus())) {
- return new StackInfo(stackName, HeatStatus.NOTFOUND);
+ stackInfo = new StackInfo(stackName, HeatStatus.NOTFOUND);
+ stackInfo.setOperationPerformed(false);
} else {
currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId);
- StackInfo stackInfo = new StackInfoMapper(currentStack).map();
+ stackInfo = new StackInfoMapper(currentStack).map();
stackInfo.setName(stackName);
- return stackInfo;
+ stackInfo.setOperationPerformed(true);
}
+ return stackInfo;
}
/**
@@ -1182,4 +1187,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
+ public void updateResourceStatus(String requestId, String resourceStatusMessage) {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId(requestId);
+ request.setResourceStatusMessage(resourceStatusMessage);
+ requestDBClient.patchInfraActiveRequests(request);
+ }
+
}