@Override public void stopVM(VMInstance a) { journal.log(Level.INFO, ">> Starting VM: "+a.getName()); OperationStatusResponse r= null; try { VirtualMachineShutdownParameters params = new VirtualMachineShutdownParameters(); params.setPostShutdownAction(PostShutdownAction.StoppedDeallocated); r = computeManagementClient.getVirtualMachinesOperations().shutdown(a.getName(), a.getName(), a.getName(),params); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } waitOperationToComplete(r.getId(),60, 100); }
postShutdownActionElement.appendChild(requestDoc.createTextNode(parameters.getPostShutdownAction().toString())); shutdownRoleOperationElement.appendChild(postShutdownActionElement);
shutdownRoleOperationElement.appendChild(operationTypeElement); if (parameters.getPostShutdownAction() != null) { Element postShutdownActionElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "PostShutdownAction"); postShutdownActionElement.appendChild(requestDoc.createTextNode(parameters.getPostShutdownAction().toString())); shutdownRoleOperationElement.appendChild(postShutdownActionElement);