Created
March 15, 2012 09:10
-
-
Save yaronp68/2043105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void stopManagementMachines() | |
throws TimeoutException, CloudProvisioningException { | |
final String token = createAuthenticationToken(); | |
final long endTime = calcEndTimeInMillis( | |
DEFAULT_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); | |
List<Node> nodes; | |
try { | |
nodes = listServers(token); | |
} catch (final OpenstackException e) { | |
throw new CloudProvisioningException(e); | |
} | |
final List<String> ids = new LinkedList<String>(); | |
for (final Node node : nodes) { | |
if (node.getName().startsWith( | |
this.serverNamePrefix)) { | |
try { | |
ids.add(node.getId()); | |
} catch (final Exception e) { | |
throw new CloudProvisioningException(e); | |
} | |
} | |
} | |
try { | |
terminateServers( | |
ids, token, endTime); | |
} catch (final TimeoutException e) { | |
throw e; | |
} catch (final Exception e) { | |
throw new CloudProvisioningException("Failed to shut down managememnt machines", e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment