@Override
public Void doRequest(NovaApi api) {
// look for victim server in all regions
ServerApi serverApi = api.getServerApiForZone(getAccount().getRegion());
Server victimServer = serverApi.get(this.victimId);
if (victimServer != null) {
releaseFloatingIps(api, getAccount().getRegion(), victimServer);
boolean wasDeleted = serverApi.delete(this.victimId);
if (!wasDeleted) {
throw new ScalingGroupException(
"failed to delete victim server " + this.victimId);
}
try {
awaitTermination(victimServer.getId());
} catch (Exception e) {
throw new ScalingGroupException(String.format(
"timed out waiting for server %s to be terminated",
e.getMessage()), e);
}