@Override public Image call() throws Exception { logger.debug(">> generalizing virtal machine %s...", vmName); api.getVirtualMachineApi(resourceGroupName).generalize(vmName); org.jclouds.azurecompute.arm.domain.Image imageFromVM = api.getVirtualMachineImageApi(resourceGroupName) .createOrUpdate(cloneTemplate.getName(), vm.location(), ImageProperties.builder().sourceVirtualMachine(vmIdRef).build()); checkState(imageAvailablePredicate.create(resourceGroupName).apply(imageFromVM.name()), "Image for node %s was not created within the configured time limit", cloneTemplate.getName()); return compose(vmImageToImage, customImagetoVmImage).apply(imageFromVM); } });
@Override public Image call() throws Exception { logger.debug(">> generalizing virtal machine %s...", vmName); api.getVirtualMachineApi(resourceGroupName).generalize(vmName); org.jclouds.azurecompute.arm.domain.Image imageFromVM = api.getVirtualMachineImageApi(resourceGroupName) .createOrUpdate(cloneTemplate.getName(), vm.location(), ImageProperties.builder().sourceVirtualMachine(vmIdRef).build()); checkState(imageAvailablePredicate.create(resourceGroupName).apply(imageFromVM.name()), "Image for node %s was not created within the configured time limit", cloneTemplate.getName()); return compose(vmImageToImage, customImagetoVmImage).apply(imageFromVM); } });
public void getVirtualMachineImage() throws InterruptedException { server.enqueue(jsonResponse("/virtualmachineimageget.json")); ImageApi imageApi = api.getVirtualMachineImageApi(resourcegroup); Image result = imageApi.get(imageName); assertSent(server, "GET", PATH); assertEquals(result.name(), imageName); assertEquals(result.location(), location); assertNotNull(result.properties().sourceVirtualMachine()); assertNotNull(result.properties().storageProfile()); }
public void createVirtualMachineImage() throws InterruptedException { server.enqueue(jsonResponse("/virtualmachineimagecreate.json")); ImageApi imageApi = api.getVirtualMachineImageApi(resourcegroup); Image result = imageApi.createOrUpdate(imageName, location, newVirtualMachineImage().properties()); assertSent(server, "PUT", PATH, "{\"location\":\"" + location + "\"," + "\"properties\":{\"sourceVirtualMachine\":{\"id\":\"vmId\"}," + "\"storageProfile\":{\"osDisk\":{\"osType\":\"Linux\",\"name\":\"Ubuntu\"},\"dataDisks\":[]}," + "\"provisioningState\":\"Succeeded\"}}"); assertEquals(result.name(), imageName); assertEquals(result.location(), location); }
@Override public VMImage apply(Image input) { return VMImage.customImage().resourceGroup(extractResourceGroup(input.id())).customImageId(input.id()).location(input.location()).name(input.name()) .offer(input.properties().storageProfile().osDisk().osType()).build(); } }
@Override public VMImage apply(Image input) { return VMImage.customImage().resourceGroup(extractResourceGroup(input.id())).customImageId(input.id()).location(input.location()).name(input.name()) .offer(input.properties().storageProfile().osDisk().osType()).build(); } }