mirror of https://github.com/apache/jclouds.git
JCLOUDS-347: Implement a poor-mans rollback if CloudStack static NAT creation fails
This commit is contained in:
parent
7ab18ffbd3
commit
f3303f03c3
|
@ -242,6 +242,7 @@ public class CloudStackComputeServiceAdapter implements
|
||||||
credentialsBuilder.password(vm.getPassword());
|
credentialsBuilder.password(vm.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (templateOptions.shouldSetupStaticNat()) {
|
if (templateOptions.shouldSetupStaticNat()) {
|
||||||
Capabilities capabilities = client.getConfigurationApi().listCapabilities();
|
Capabilities capabilities = client.getConfigurationApi().listCapabilities();
|
||||||
// TODO: possibly not all network ids, do we want to do this
|
// TODO: possibly not all network ids, do we want to do this
|
||||||
|
@ -262,6 +263,15 @@ public class CloudStackComputeServiceAdapter implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (RuntimeException re) {
|
||||||
|
logger.error("-- exception after node has been created, trying to destroy the created virtualMachine(%s)", vm.getId());
|
||||||
|
try {
|
||||||
|
destroyNode(vm.getId());
|
||||||
|
} catch (RuntimeException re2) {
|
||||||
|
logger.debug("-- exception in exceptionHandler while executing destroyNode for virtualMachine(%s), ignoring and rethrowing original exception", vm.getId());
|
||||||
|
}
|
||||||
|
throw re;
|
||||||
|
}
|
||||||
return new NodeAndInitialCredentials<VirtualMachine>(vm, vm.getId() + "", credentialsBuilder.build());
|
return new NodeAndInitialCredentials<VirtualMachine>(vm, vm.getId() + "", credentialsBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue