Commit 6da20c5e authored by Spiros Koulouzis's avatar Spiros Koulouzis

delete all provisioned topologies

parent dc281aeb
...@@ -110,11 +110,19 @@ public class DRIPCaller implements AutoCloseable { ...@@ -110,11 +110,19 @@ public class DRIPCaller implements AutoCloseable {
String jsonInString = mapper.writeValueAsString(r); String jsonInString = mapper.writeValueAsString(r);
int timeOut = 25;
if (getRequestQeueName().equals("planner")) {
timeOut = 5;
}
if (getRequestQeueName().equals("provisioner")) {
timeOut = 10;
}
//Build a correlation ID to distinguish responds //Build a correlation ID to distinguish responds
final String corrId = UUID.randomUUID().toString(); final String corrId = UUID.randomUUID().toString();
AMQP.BasicProperties props = new AMQP.BasicProperties.Builder() AMQP.BasicProperties props = new AMQP.BasicProperties.Builder()
.correlationId(corrId) .correlationId(corrId)
.expiration("10000") .expiration(String.valueOf(timeOut*60000))
.replyTo(getReplyQueueName()) .replyTo(getReplyQueueName())
.build(); .build();
Logger.getLogger(DRIPCaller.class.getName()).log(Level.INFO, "Sending: {0} to queue: {1}", new Object[]{jsonInString, getRequestQeueName()}); Logger.getLogger(DRIPCaller.class.getName()).log(Level.INFO, "Sending: {0} to queue: {1}", new Object[]{jsonInString, getRequestQeueName()});
...@@ -132,13 +140,6 @@ public class DRIPCaller implements AutoCloseable { ...@@ -132,13 +140,6 @@ public class DRIPCaller implements AutoCloseable {
} }
}); });
// String resp = response.take(); // String resp = response.take();
int timeOut = 25;
if (getRequestQeueName().equals("planner")) {
timeOut = 5;
}
if (getRequestQeueName().equals("provisioner")) {
timeOut = 10;
}
String resp = response.poll(timeOut, TimeUnit.MINUTES); String resp = response.poll(timeOut, TimeUnit.MINUTES);
Logger.getLogger(DRIPCaller.class.getName()).log(Level.INFO, "Got: {0}", resp); Logger.getLogger(DRIPCaller.class.getName()).log(Level.INFO, "Got: {0}", resp);
......
...@@ -162,15 +162,22 @@ public class DRIPService { ...@@ -162,15 +162,22 @@ public class DRIPService {
public String delete(String id, List<String> nodeNames) throws NotFoundException, IOException, JsonProcessingException, ApiException, TypeExeption, TimeoutException, InterruptedException { public String delete(String id, List<String> nodeNames) throws NotFoundException, IOException, JsonProcessingException, ApiException, TypeExeption, TimeoutException, InterruptedException {
ToscaTemplate toscaTemplate = initExecution(id); ToscaTemplate toscaTemplate = initExecution(id);
boolean nothingToDelete = true;
//If no nodes are specified delete all the infrastructure //If no nodes are specified delete all the infrastructure
if (nodeNames == null || nodeNames.isEmpty()) { if (nodeNames == null || nodeNames.isEmpty()) {
List<NodeTemplateMap> vmTopologies = helper.getVMTopologyTemplates(); List<NodeTemplateMap> vmTopologies = helper.getVMTopologyTemplates();
if (vmTopologies != null) { if (vmTopologies != null) {
for (NodeTemplateMap vmTopology : vmTopologies) { for (NodeTemplateMap vmTopology : vmTopologies) {
NODE_STATES currentState = helper.getNodeCurrentState(vmTopology);
if (currentState != null && currentState != NODE_STATES.DELETED) {
nothingToDelete = false;
toscaTemplate = setDesieredSate(toscaTemplate, vmTopology, NODE_STATES.DELETED); toscaTemplate = setDesieredSate(toscaTemplate, vmTopology, NODE_STATES.DELETED);
} }
}
if (!nothingToDelete) {
return execute(toscaTemplate, provisionerQueueName); return execute(toscaTemplate, provisionerQueueName);
} }
}
return id; return id;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment