@Test public void destroy() throws Exception { Vm vmDescription = new Vm("TestVM", testingImageId, 1, 1024, 2, null, "app1"); String instanceId = openStackJclouds.deploy(vmDescription, null); openStackJclouds.destroy(instanceId); List<String> instancesIds = openStackJclouds.getAllVMsIds(); assertFalse(instancesIds.contains(instanceId)); }
@Override public void destroy(String vmId) throws CloudMiddlewareException { assertVmId(vmId); Server server = openStackJcloudsApis.getServerApi().get(vmId); if (server != null) { openStackJcloudsApis.getServerApi().delete(vmId); blockUntilVmIsDeleted(vmId); } }
OpenStackJclouds implements CloudMiddleware { @Override public void destroy(String vmId) throws CloudMiddlewareException { assertVmId(vmId); Server server = openStackJcloudsApis.getServerApi().get(vmId); if (server != null) { openStackJcloudsApis.getServerApi().delete(vmId); blockUntilVmIsDeleted(vmId); } } }
OpenStackJclouds implements CloudMiddleware { @Override public void destroy(String vmId) throws CloudMiddlewareException { assertVmId(vmId); Server server = openStackJcloudsApis.getServerApi().get(vmId); if (server != null) { openStackJcloudsApis.getServerApi().delete(vmId); blockUntilVmIsDeleted(vmId); } } OpenStackJclouds(OpenStackCredentials openStackCredentials, String[] securityGroups, String[] hostNames); }
OpenStackJclouds implements CloudMiddleware { @Override public void destroy(String vmId) throws CloudMiddlewareException { assertVmId(vmId); Server server = openStackJcloudsApis.getServerApi().get(vmId); if (server != null) { openStackJcloudsApis.getServerApi().delete(vmId); blockUntilVmIsDeleted(vmId); } } OpenStackJclouds(OpenStackCredentials openStackCredentials, String[] securityGroups, String[] hostNames); @Override // This function is blocking. The thread execution blocks until the VM is deployed. // I would prefer to see this blocking in the VmManager class. I need to block the execution because // I need to return the ID of the deployed VM to the Application Manager. String deploy(Vm vm, String hostname); @Override String deployWithVolume(Vm vm, String hostname, String isoPath); @Override // This function is also blocking. The reason is the same as in the deploy function. void destroy(String vmId); @Override void migrate(String vmId, String destinationNodeHostName); @Override List<String> getAllVMsIds(); @Override List<String> getScheduledNonDeployedVmsIds(); @Override VmDeployed getVM(String vmId); @Override boolean existsVm(String vmId); @Override void rebootHardVm(String vmId); @Override void rebootSoftVm(String vmId); @Override void startVm(String vmId); @Override void stopVm(String vmId); @Override void suspendVm(String vmId); @Override void resumeVm(String vmId); @Override List<ImageUploaded> getVmImages(); @Override String createVmImage(ImageToUpload imageToUpload); @Override ImageUploaded getVmImage(String imageId); @Override void deleteVmImage(String id); @Override void assignFloatingIp(String vmId); String getZone(); NovaApi getNovaApi(); }
OpenStackJclouds implements CloudMiddleware { @Override public void destroy(String vmId) throws CloudMiddlewareException { assertVmId(vmId); Server server = openStackJcloudsApis.getServerApi().get(vmId); if (server != null) { openStackJcloudsApis.getServerApi().delete(vmId); blockUntilVmIsDeleted(vmId); } } OpenStackJclouds(OpenStackCredentials openStackCredentials, String[] securityGroups, String[] hostNames); @Override // This function is blocking. The thread execution blocks until the VM is deployed. // I would prefer to see this blocking in the VmManager class. I need to block the execution because // I need to return the ID of the deployed VM to the Application Manager. String deploy(Vm vm, String hostname); @Override String deployWithVolume(Vm vm, String hostname, String isoPath); @Override // This function is also blocking. The reason is the same as in the deploy function. void destroy(String vmId); @Override void migrate(String vmId, String destinationNodeHostName); @Override List<String> getAllVMsIds(); @Override List<String> getScheduledNonDeployedVmsIds(); @Override VmDeployed getVM(String vmId); @Override boolean existsVm(String vmId); @Override void rebootHardVm(String vmId); @Override void rebootSoftVm(String vmId); @Override void startVm(String vmId); @Override void stopVm(String vmId); @Override void suspendVm(String vmId); @Override void resumeVm(String vmId); @Override List<ImageUploaded> getVmImages(); @Override String createVmImage(ImageToUpload imageToUpload); @Override ImageUploaded getVmImage(String imageId); @Override void deleteVmImage(String id); @Override void assignFloatingIp(String vmId); String getZone(); NovaApi getNovaApi(); static final String[] DEFAULT_FLAVORS; }