Search in sources :

Example 51 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class AzureTestUtil method createDefaultVMResource.

public static ComputeState createDefaultVMResource(VerificationHost host, String azureVMName, ComputeState computeHost, EndpointState endpointState, AzureNicSpecs nicSpecs, String networkRGLink, ImageSource imageSource, int numberOfAdditionalDisks, ComputeDescription azureVMDesc, String azureRgName) throws Throwable {
    if (azureRgName == null) {
        azureRgName = azureVMName;
    }
    final ResourceGroupState defaultVmRG = createDefaultResourceGroupState(host, azureRgName, computeHost, endpointState, ResourceGroupStateType.AzureResourceGroup);
    final String defaultVmRGLink = defaultVmRG.documentSelfLink;
    if (networkRGLink == null) {
        // The RG where the VM is deployed is also used as RG for the Network!
        networkRGLink = defaultVmRGLink;
    }
    // The RG where the VM is deployed is also used as RG for the SecurityGroup!
    final String sgRGLink = defaultVmRGLink;
    // Create resource group with a different type. It should be filtered out.
    ResourceGroupState azureStorageContainerRG = createDefaultResourceGroupState(host, AZURE_STORAGE_CONTAINER_RG_NAME, computeHost, endpointState, ResourceGroupStateType.AzureStorageContainer);
    final Set<String> networkRGLinks = new HashSet<>();
    networkRGLinks.add(networkRGLink);
    networkRGLinks.add(azureStorageContainerRG.documentSelfLink);
    final Set<String> sgRGLinks = new HashSet<>();
    sgRGLinks.add(sgRGLink);
    sgRGLinks.add(azureStorageContainerRG.documentSelfLink);
    if (azureVMDesc == null) {
        azureVMDesc = buildComputeDescription(host, computeHost, endpointState, null);
    }
    List<String> vmDisks = new ArrayList<>();
    DiskState rootDisk = new DiskState();
    rootDisk.name = azureVMName + "-boot-disk";
    rootDisk.id = UUID.randomUUID().toString();
    rootDisk.documentSelfLink = rootDisk.id;
    rootDisk.type = DiskType.HDD;
    // Custom OSDisk size of 32 GBs
    rootDisk.capacityMBytes = AZURE_CUSTOM_OSDISK_SIZE;
    if (imageSource.type == Type.PRIVATE_IMAGE || imageSource.type == Type.PUBLIC_IMAGE) {
        rootDisk.imageLink = imageSource.asImageState().documentSelfLink;
    } else if (imageSource.type == Type.IMAGE_REFERENCE) {
        rootDisk.sourceImageReference = URI.create(imageSource.asRef());
    }
    rootDisk.bootOrder = 1;
    rootDisk.endpointLink = endpointState.documentSelfLink;
    rootDisk.endpointLinks = new HashSet<>();
    rootDisk.endpointLinks.add(endpointState.documentSelfLink);
    rootDisk.computeHostLink = computeHost.documentSelfLink;
    rootDisk.tenantLinks = endpointState.tenantLinks;
    rootDisk.storageType = AZURE_STORAGE_DISKS;
    rootDisk.tagLinks = createTagStateSet(host, endpointState.tenantLinks, TAG_KEY_TYPE, AzureResourceType.azure_vhd.name());
    rootDisk.customProperties = new HashMap<>();
    rootDisk.customProperties.put(AZURE_OSDISK_CACHING, DEFAULT_OS_DISK_CACHING.name());
    rootDisk.customProperties.put(AzureConstants.AZURE_STORAGE_ACCOUNT_NAME, (azureVMName + "sa").replaceAll("[_-]", "").toLowerCase());
    rootDisk.customProperties.put(AzureConstants.AZURE_STORAGE_ACCOUNT_RG_NAME, azureRgName);
    rootDisk.customProperties.put(AzureConstants.AZURE_STORAGE_ACCOUNT_TYPE, AZURE_STORAGE_ACCOUNT_TYPE);
    rootDisk = TestUtils.doPost(host, rootDisk, DiskState.class, UriUtils.buildUri(host, DiskService.FACTORY_LINK));
    vmDisks.add(rootDisk.documentSelfLink);
    // create additional disks
    vmDisks.addAll(createAdditionalDisks(host, azureVMName, endpointState, numberOfAdditionalDisks, VMResourceSpec.PersistentDisks.NONE, false));
    // Create NICs
    List<String> nicLinks = createDefaultNicStates(host, computeHost, endpointState, networkRGLinks, sgRGLinks, nicSpecs, azureVMName).stream().map(nic -> nic.documentSelfLink).collect(Collectors.toList());
    // Finally create the compute resource state to provision using all constructs above.
    ComputeState computeState = new ComputeState();
    computeState.id = UUID.randomUUID().toString();
    computeState.name = azureVMName;
    computeState.parentLink = computeHost.documentSelfLink;
    computeState.type = ComputeType.VM_GUEST;
    computeState.environmentName = ComputeDescription.ENVIRONMENT_NAME_AZURE;
    computeState.descriptionLink = azureVMDesc.documentSelfLink;
    computeState.resourcePoolLink = computeHost.resourcePoolLink;
    computeState.diskLinks = vmDisks;
    computeState.networkInterfaceLinks = nicLinks;
    computeState.customProperties = Collections.singletonMap(RESOURCE_GROUP_NAME, azureRgName);
    computeState.groupLinks = Collections.singleton(defaultVmRGLink);
    computeState.endpointLink = endpointState.documentSelfLink;
    computeState.endpointLinks = new HashSet<>();
    computeState.endpointLinks.add(endpointState.documentSelfLink);
    computeState.computeHostLink = computeHost.documentSelfLink;
    computeState.tenantLinks = endpointState.tenantLinks;
    computeState.tagLinks = createTagStateSet(host, endpointState.tenantLinks, TAG_KEY_TYPE, AzureConstants.AzureResourceType.azure_vm.toString());
    computeState.creationTimeMicros = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis());
    return TestUtils.doPost(host, computeState, ComputeState.class, UriUtils.buildUri(host, ComputeService.FACTORY_LINK));
}
Also used : AZURE_STORAGE_ACCOUNTS(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_ACCOUNTS) NetworkManagementClientImpl(com.microsoft.azure.management.network.implementation.NetworkManagementClientImpl) AZURE_STORAGE_BLOBS(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_BLOBS) IpAssignment(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.IpAssignment) VerificationHost(com.vmware.xenon.common.test.VerificationHost) VirtualNetworkInner(com.microsoft.azure.management.network.implementation.VirtualNetworkInner) ResourceGroupState(com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState) InetAddress(java.net.InetAddress) Utils(com.vmware.xenon.common.Utils) QueryTerm(com.vmware.xenon.services.common.QueryTask.QueryTerm) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) GatewaySpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs.GatewaySpec) StorageDescription(com.vmware.photon.controller.model.resources.StorageDescriptionService.StorageDescription) COMPUTE_HOST_LINK_PROP_NAME(com.vmware.photon.controller.model.ComputeProperties.COMPUTE_HOST_LINK_PROP_NAME) ImageService(com.vmware.photon.controller.model.resources.ImageService) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) EnumSet(java.util.EnumSet) VirtualNetworkGatewayIPConfigurationInner(com.microsoft.azure.management.network.implementation.VirtualNetworkGatewayIPConfigurationInner) ResourceEnumerationTaskService(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService) AZURE_STORAGE_ACCOUNT_KEY1(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_ACCOUNT_KEY1) AZURE_STORAGE_ACCOUNT_KEY2(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_ACCOUNT_KEY2) SubnetService(com.vmware.photon.controller.model.resources.SubnetService) CachingTypes(com.microsoft.azure.management.compute.CachingTypes) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) DEFAULT_INSTANCE_ADAPTER_REFERENCE(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.DEFAULT_INSTANCE_ADAPTER_REFERENCE) Set(java.util.Set) SecurityRuleAccess(com.microsoft.azure.management.network.SecurityRuleAccess) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) AZURE_STORAGE_CONTAINER_LEASE_STATUS(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_CONTAINER_LEASE_STATUS) TagService(com.vmware.photon.controller.model.resources.TagService) StorageDescriptionService(com.vmware.photon.controller.model.resources.StorageDescriptionService) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) AZURE_STORAGE_CONTAINER_LEASE_STATE(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_CONTAINER_LEASE_STATE) TaskState(com.vmware.xenon.common.TaskState) AZURE_DATA_DISK_CACHING(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_DATA_DISK_CACHING) ResourceMetrics(com.vmware.photon.controller.model.monitoring.ResourceMetricsService.ResourceMetrics) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ResourceGroupStateType(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.ResourceGroupStateType) ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) ComputeDescriptionService(com.vmware.photon.controller.model.resources.ComputeDescriptionService) PhotonModelUtils(com.vmware.photon.controller.model.resources.util.PhotonModelUtils) AzureResourceType.azure_net_interface(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_net_interface) TagsUtil(com.vmware.photon.controller.model.adapters.util.TagsUtil) ArrayList(java.util.ArrayList) VirtualNetworkGatewayInner(com.microsoft.azure.management.network.implementation.VirtualNetworkGatewayInner) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) Rule(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState.Rule) TagState(com.vmware.photon.controller.model.resources.TagService.TagState) EndpointConfigRequest(com.vmware.photon.controller.model.adapterapi.EndpointConfigRequest) MEMORY_USED_PERCENT(com.vmware.photon.controller.model.constants.PhotonModelConstants.MEMORY_USED_PERCENT) ResourceRemovalTaskState(com.vmware.photon.controller.model.tasks.ResourceRemovalTaskService.ResourceRemovalTaskState) CPU_UTILIZATION_PERCENT(com.vmware.photon.controller.model.constants.PhotonModelConstants.CPU_UTILIZATION_PERCENT) VirtualNetworkGatewayType(com.microsoft.azure.management.network.VirtualNetworkGatewayType) AZURE_STORAGE_CONTAINER_LEASE_LAST_MODIFIED(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_CONTAINER_LEASE_LAST_MODIFIED) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner) PublicIPAddressInner(com.microsoft.azure.management.network.implementation.PublicIPAddressInner) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) VirtualNetworkGatewaySkuName(com.microsoft.azure.management.network.VirtualNetworkGatewaySkuName) ServiceCallback(com.microsoft.rest.ServiceCallback) SubnetInner(com.microsoft.azure.management.network.implementation.SubnetInner) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) SecurityGroupService(com.vmware.photon.controller.model.resources.SecurityGroupService) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) ImageSource(com.vmware.photon.controller.model.adapters.util.instance.BaseComputeInstanceContext.ImageSource) AzureComputeEnumerationAdapterService(com.vmware.photon.controller.model.adapters.azure.enumeration.AzureComputeEnumerationAdapterService) NetworkService(com.vmware.photon.controller.model.resources.NetworkService) Assert.assertNull(org.junit.Assert.assertNull) ClusterUtil(com.vmware.photon.controller.model.util.ClusterUtil) SecurityRuleInner(com.microsoft.azure.management.network.implementation.SecurityRuleInner) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) QuerySpecification(com.vmware.xenon.services.common.QueryTask.QuerySpecification) Assert.assertEquals(org.junit.Assert.assertEquals) STORAGE_USED_BYTES(com.vmware.photon.controller.model.constants.PhotonModelConstants.STORAGE_USED_BYTES) NicSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs.NicSpec) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) SecurityRuleProtocol(com.microsoft.azure.management.network.SecurityRuleProtocol) IPAllocationMethod(com.microsoft.azure.management.network.IPAllocationMethod) QueryTask(com.vmware.xenon.services.common.QueryTask) StatsCollectionTaskState(com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService.StatsCollectionTaskState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) Random(java.util.Random) AzureUriPaths(com.vmware.photon.controller.model.adapters.azure.AzureUriPaths) DEFAULT_DISK_TYPE(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.DEFAULT_DISK_TYPE) StatsAggregationTaskService(com.vmware.photon.controller.model.tasks.monitoring.StatsAggregationTaskService) ByteBuffer(java.nio.ByteBuffer) DiskType(com.vmware.photon.controller.model.resources.DiskService.DiskType) ComputeType(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType) AzureResourceType.azure_subnet(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_subnet) ResourceManagementClientImpl(com.microsoft.azure.management.resources.implementation.ResourceManagementClientImpl) StatsAggregationTaskState(com.vmware.photon.controller.model.tasks.monitoring.StatsAggregationTaskService.StatsAggregationTaskState) EndpointService(com.vmware.photon.controller.model.resources.EndpointService) CUSTOM_PROP_ENDPOINT_LINK(com.vmware.photon.controller.model.constants.PhotonModelConstants.CUSTOM_PROP_ENDPOINT_LINK) ResourcePoolService(com.vmware.photon.controller.model.resources.ResourcePoolService) URI(java.net.URI) SecurityRuleDirection(com.microsoft.azure.management.network.SecurityRuleDirection) StatsCollectionTaskService(com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) AzureConstants(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) SkuName(com.microsoft.azure.management.storage.SkuName) AddressSpace(com.microsoft.azure.management.network.AddressSpace) NetworkInterfaceDescriptionService(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService) DiskConfiguration(com.vmware.photon.controller.model.resources.ImageService.ImageState.DiskConfiguration) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) AZURE_STORAGE_CONTAINERS(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_CONTAINERS) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) ENDPOINT_LINK_EXPLICIT_SUPPORT(com.vmware.photon.controller.model.resources.util.PhotonModelUtils.ENDPOINT_LINK_EXPLICIT_SUPPORT) Objects(java.util.Objects) ResourceGroupService(com.vmware.photon.controller.model.resources.ResourceGroupService) List(java.util.List) AzureUtils(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils) TAG_KEY_TYPE(com.vmware.photon.controller.model.constants.PhotonModelConstants.TAG_KEY_TYPE) VirtualNetworkGatewaySkuTier(com.microsoft.azure.management.network.VirtualNetworkGatewaySkuTier) QueryOption(com.vmware.xenon.services.common.QueryTask.QuerySpecification.QueryOption) InstanceViewTypes(com.microsoft.azure.management.compute.InstanceViewTypes) NetworkSecurityGroupInner(com.microsoft.azure.management.network.implementation.NetworkSecurityGroupInner) AzureEnumerationAdapterService(com.vmware.photon.controller.model.adapters.azure.enumeration.AzureEnumerationAdapterService) TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) DiskService(com.vmware.photon.controller.model.resources.DiskService) SubResource(com.microsoft.azure.SubResource) AZURE_OSDISK_CACHING(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_OSDISK_CACHING) Type(com.vmware.photon.controller.model.adapters.util.instance.BaseComputeInstanceContext.ImageSource.Type) ResourceGroupInner(com.microsoft.azure.management.resources.implementation.ResourceGroupInner) ResourceRemovalTaskService(com.vmware.photon.controller.model.tasks.ResourceRemovalTaskService) Region(com.microsoft.azure.management.resources.fluentcore.arm.Region) HashMap(java.util.HashMap) ResourceMetricsService(com.vmware.photon.controller.model.monitoring.ResourceMetricsService) Level(java.util.logging.Level) HashSet(java.util.HashSet) AZURE_STORAGE_TYPE(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_TYPE) AuthCredentialsService(com.vmware.xenon.services.common.AuthCredentialsService) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) DEFAULT_DISK_CAPACITY(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.DEFAULT_DISK_CAPACITY) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) EndpointType(com.vmware.photon.controller.model.constants.PhotonModelConstants.EndpointType) AzureResourceType(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType) VpnType(com.microsoft.azure.management.network.VpnType) AZURE_TENANT_ID(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_TENANT_ID) ComputeManagementClientImpl(com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl) ResourceEnumerationTaskState(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService.ResourceEnumerationTaskState) Assert.assertNotNull(org.junit.Assert.assertNotNull) AzureResourceType.azure_vnet(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_vnet) Operation(com.vmware.xenon.common.Operation) AZURE_STORAGE_DISKS(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_DISKS) VirtualNetworkGatewaySku(com.microsoft.azure.management.network.VirtualNetworkGatewaySku) TimeUnit(java.util.concurrent.TimeUnit) CloudException(com.microsoft.azure.CloudException) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState) NetworkInterfaceDescription(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.NetworkInterfaceDescription) ServiceDocumentDescription(com.vmware.xenon.common.ServiceDocumentDescription) Collections(java.util.Collections) RESOURCE_GROUP_NAME(com.vmware.photon.controller.model.ComputeProperties.RESOURCE_GROUP_NAME) NetSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs.NetSpec) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ResourceGroupState(com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 52 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class AzureTestUtil method validateDiskInternalTag.

/**
 * Validate DiskStates are populated with the appropriate type tagLinks
 */
public static void validateDiskInternalTag(VerificationHost host) {
    ServiceDocumentQueryResult result = host.getExpandedFactoryState(UriUtils.buildUri(host, DiskService.FACTORY_LINK));
    List<String> tenantLinks = Collections.singletonList(EndpointType.azure.name() + "-tenant");
    String managedDiskTagLink = getTagState(tenantLinks, TAG_KEY_TYPE, AzureResourceType.azure_managed_disk.name()).documentSelfLink;
    String vhdTagLink = getTagState(tenantLinks, TAG_KEY_TYPE, AzureResourceType.azure_vhd.name()).documentSelfLink;
    String blobTagLink = getTagState(tenantLinks, TAG_KEY_TYPE, AzureResourceType.azure_blob.name()).documentSelfLink;
    for (Object document : result.documents.values()) {
        DiskState state = Utils.fromJson(document, DiskState.class);
        if (state.storageType != null) {
            switch(state.storageType) {
                case AZURE_STORAGE_DISKS:
                    if (state.customProperties != null && state.customProperties.containsKey(AzureConstants.AZURE_MANAGED_DISK_TYPE)) {
                        // check tagLink for managed disks
                        assertTrue(state.tagLinks.contains(managedDiskTagLink));
                    } else {
                        // check tagLink for vhds
                        assertTrue(state.tagLinks.contains(vhdTagLink));
                    }
                    break;
                case AZURE_STORAGE_BLOBS:
                    assertTrue(state.tagLinks.contains(blobTagLink));
                    break;
                default:
                    break;
            }
        }
    }
}
Also used : DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult)

Example 53 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class AzureTestUtil method createAdditionalDisks.

public static List<String> createAdditionalDisks(VerificationHost host, String azureVMName, EndpointState endpointState, int numberOfDisks, VMResourceSpec.PersistentDisks persist, boolean isManagedDisk) throws Throwable {
    List<String> diskStateArrayList = new ArrayList<>();
    for (int i = 0; i < numberOfDisks; i++) {
        DiskState dataDisk = new DiskState();
        dataDisk.name = azureVMName + "-data-disk-" + i;
        dataDisk.id = UUID.randomUUID().toString();
        dataDisk.type = DiskType.HDD;
        // Custom Data Disk size of 20GB
        dataDisk.capacityMBytes = AZURE_CUSTOM_DATA_DISK_SIZE;
        dataDisk.bootOrder = 2;
        dataDisk.endpointLink = endpointState.documentSelfLink;
        dataDisk.endpointLinks = new HashSet<>();
        dataDisk.endpointLinks.add(endpointState.documentSelfLink);
        dataDisk.computeHostLink = endpointState.computeHostLink;
        dataDisk.tenantLinks = endpointState.tenantLinks;
        dataDisk.storageType = AZURE_STORAGE_DISKS;
        dataDisk.customProperties = new HashMap<>();
        dataDisk.customProperties.put(AZURE_DATA_DISK_CACHING, DEFAULT_DATA_DISK_CACHING.toString());
        dataDisk.persistent = false;
        // Conditionally set persistence flag on additional disks
        if (persist == VMResourceSpec.PersistentDisks.ALL) {
            dataDisk.persistent = true;
        } else if (persist == VMResourceSpec.PersistentDisks.NONE) {
            dataDisk.persistent = false;
        } else {
            dataDisk.persistent = (i % 2) == 0 ? true : false;
        }
        if (!isManagedDisk) {
            dataDisk.customProperties.put(AzureConstants.AZURE_STORAGE_ACCOUNT_NAME, (azureVMName + "sa").replace("-", "").toLowerCase());
            dataDisk.customProperties.put(AzureConstants.AZURE_STORAGE_ACCOUNT_RG_NAME, azureVMName);
            dataDisk.customProperties.put(AzureConstants.AZURE_STORAGE_ACCOUNT_TYPE, AZURE_STORAGE_ACCOUNT_TYPE);
        } else {
            dataDisk.customProperties.put(AzureConstants.AZURE_MANAGED_DISK_TYPE, SkuName.STANDARD_LRS.toString());
        }
        dataDisk = TestUtils.doPost(host, dataDisk, DiskState.class, UriUtils.buildUri(host, DiskService.FACTORY_LINK));
        diskStateArrayList.add(dataDisk.documentSelfLink);
    }
    return diskStateArrayList;
}
Also used : DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) ArrayList(java.util.ArrayList)

Example 54 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class TestAzureProvisionTask method testProvisionDataDisksAndEnumeration.

/**
 * Creates Azure instance with 2 data disks via provision task and enumerate the disks
 * and verify disk duplication in local store.
 */
@Test
public void testProvisionDataDisksAndEnumeration() throws Throwable {
    ImageSource imageSource = createImageSource(getHost(), this.endpointState, IMAGE_REFERENCE);
    // Create a Azure VM compute resource with 2 additional disks.
    int numberOfAdditionalDisks = 2;
    VMResourceSpec vmResourceSpec = new VMResourceSpec(getHost(), this.computeHost, this.endpointState, azureVMName).withImageSource(imageSource).withNicSpecs(DEFAULT_NIC_SPEC).withNumberOfAdditionalDisks(numberOfAdditionalDisks).withManagedDisk(false);
    // create Azure VM compute resource.
    this.vmState = createVMResourceFromSpec(vmResourceSpec);
    kickOffProvisionTask();
    runEnumeration();
    // Assert if 2 additional disks were created
    List<DiskState> diskStates = this.vmState.diskLinks.stream().map(diskLink -> getHost().getServiceState(null, DiskState.class, UriUtils.buildUri(getHost(), diskLink))).collect(Collectors.toList());
    for (DiskState diskState : diskStates) {
        if (diskState.bootOrder == 1) {
            assertEquals("OS Disk size does not match", AzureTestUtil.AZURE_CUSTOM_OSDISK_SIZE, diskState.capacityMBytes);
        } else {
            assertEquals("Data Disk size does not match", AzureTestUtil.AZURE_CUSTOM_DATA_DISK_SIZE, diskState.capacityMBytes);
            if (!this.isMock) {
                assertNotNull(diskState.customProperties);
                assertNotNull(diskState.customProperties.get(DISK_CONTROLLER_NUMBER));
            }
        }
    }
    // Run enumeration second time to verify disk states are not duplicated
    runEnumeration();
    ServiceDocumentQueryResult result = ProvisioningUtils.queryAllFactoryResources(this.host, DiskService.FACTORY_LINK);
    List<DiskState> diskList = result.documents.keySet().stream().map(diskLink -> getHost().getServiceState(null, DiskState.class, UriUtils.buildUri(getHost(), diskLink))).collect(Collectors.toList());
    for (DiskState diskState : diskStates) {
        long nameCount = diskList.stream().filter(ds -> ds.name.equalsIgnoreCase(diskState.name)).count();
        String msg = String.format("Duplicate of DiskState %s must not be present. ", diskState.name);
        assertEquals(msg, 1, nameCount);
        long idCount = diskList.stream().filter(ds -> ds.id.equalsIgnoreCase(diskState.id)).count();
        String idMsg = String.format("Duplicate of DiskState ID %s must not be present. ", diskState.id);
        assertEquals(idMsg, 1, idCount);
    }
}
Also used : NicSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs.NicSpec) NetworkManagementClientImpl(com.microsoft.azure.management.network.implementation.NetworkManagementClientImpl) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService) IpAssignment(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.IpAssignment) AzureTestUtil.deleteVMs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.deleteVMs) SHARED_NETWORK_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.SHARED_NETWORK_NIC_SPEC) VirtualNetworkInner(com.microsoft.azure.management.network.implementation.VirtualNetworkInner) DISK_CONTROLLER_NUMBER(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.DISK_CONTROLLER_NUMBER) AzureUriPaths(com.vmware.photon.controller.model.adapters.azure.AzureUriPaths) NetworkInterfaceStateWithDescription(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceStateWithDescription) ResourceGroupState(com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState) Map(java.util.Map) After(org.junit.After) StorageDescription(com.vmware.photon.controller.model.resources.StorageDescriptionService.StorageDescription) Assert.fail(org.junit.Assert.fail) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) OSDisk(com.microsoft.azure.management.compute.OSDisk) EnumSet(java.util.EnumSet) ResourceEnumerationTaskService(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService) AzureConstants(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants) DEFAULT_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.DEFAULT_NIC_SPEC) ComputeStatsResponse(com.vmware.photon.controller.model.adapterapi.ComputeStatsResponse) ComputeStatsRequest(com.vmware.photon.controller.model.adapterapi.ComputeStatsRequest) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) VMResourceSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.VMResourceSpec) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) UUID(java.util.UUID) AzureTestUtil.createPrivateImageSource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createPrivateImageSource) AzureTestUtil.createVMResourceFromSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createVMResourceFromSpec) Collectors(java.util.stream.Collectors) NO_PUBLIC_IP_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.NO_PUBLIC_IP_NIC_SPEC) List(java.util.List) AzureUtils(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils) AzureTestUtil.createImageSource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createImageSource) StorageDescriptionService(com.vmware.photon.controller.model.resources.StorageDescriptionService) UriUtils(com.vmware.xenon.common.UriUtils) Optional(java.util.Optional) NetworkSecurityGroupInner(com.microsoft.azure.management.network.implementation.NetworkSecurityGroupInner) AzureEnumerationAdapterService(com.vmware.photon.controller.model.adapters.azure.enumeration.AzureEnumerationAdapterService) TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) DiskService(com.vmware.photon.controller.model.resources.DiskService) AzureTestUtil.createDefaultResourceGroupState(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultResourceGroupState) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ResourceGroupStateType(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.ResourceGroupStateType) ResourceGroupInner(com.microsoft.azure.management.resources.implementation.ResourceGroupInner) PhotonModelMetricServices(com.vmware.photon.controller.model.PhotonModelMetricServices) Function(java.util.function.Function) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) AzureTestUtil.createDefaultVMResource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultVMResource) Level(java.util.logging.Level) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) Assume(org.junit.Assume) IMAGE_REFERENCE(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.IMAGE_REFERENCE) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner) AzureNicSpecs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs) PRIVATE_IP_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.PRIVATE_IP_NIC_SPEC) DataDisk(com.microsoft.azure.management.compute.DataDisk) Assert.assertNotNull(org.junit.Assert.assertNotNull) Operation(com.vmware.xenon.common.Operation) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ImageSource(com.vmware.photon.controller.model.adapters.util.instance.BaseComputeInstanceContext.ImageSource) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) AZURE_CUSTOM_DATA_DISK_SIZE(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AZURE_CUSTOM_DATA_DISK_SIZE) Assert.assertNull(org.junit.Assert.assertNull) Ignore(org.junit.Ignore) AzureTestUtil.generateName(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.generateName) Assert.assertEquals(org.junit.Assert.assertEquals) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) AzureTestUtil.createPrivateImageSource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createPrivateImageSource) AzureTestUtil.createImageSource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createImageSource) ImageSource(com.vmware.photon.controller.model.adapters.util.instance.BaseComputeInstanceContext.ImageSource) VMResourceSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.VMResourceSpec) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) Test(org.junit.Test)

Example 55 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class TestAzureProvisionTask method assertConfigurationOfDisks.

private void assertConfigurationOfDisks(int numberOfAdditionalDisks, int numberOfDataDisksOnImage) {
    ComputeState vm = getHost().getServiceState(null, ComputeState.class, UriUtils.buildUri(getHost(), this.vmState.documentSelfLink));
    List<DiskState> diskStates = vm.diskLinks.stream().map(diskLink -> getHost().getServiceState(null, DiskState.class, UriUtils.buildUri(getHost(), diskLink))).collect(Collectors.toList());
    if (numberOfDataDisksOnImage == 0) {
        for (DiskState diskState : diskStates) {
            if (diskState.bootOrder == 1) {
                assertEquals("OS Disk size does not match", AzureTestUtil.AZURE_CUSTOM_OSDISK_SIZE, diskState.capacityMBytes);
            } else {
                assertEquals("Data Disk size does not match", AzureTestUtil.AZURE_CUSTOM_DATA_DISK_SIZE, diskState.capacityMBytes);
                assertNotNull(diskState.customProperties);
                assertNotNull(diskState.customProperties.get(DISK_CONTROLLER_NUMBER));
            }
        }
    }
    if (this.isMock) {
        // return. Nothing to check on Azure.
        return;
    }
    final String vmRGName = vm.customProperties.get(ComputeProperties.RESOURCE_GROUP_NAME);
    VirtualMachineInner provisionedVM = null;
    try {
        provisionedVM = AzureTestUtil.getAzureVirtualMachine(getAzureSdkClients().getComputeManagementClientImpl(), vmRGName, this.vmState.name.replace('_', '-'));
    } catch (Exception e) {
        fail("Unable to get Azure VM details: " + e.getMessage());
    }
    final Function<String, Optional<DiskState>> findDiskStateByName = diskName -> diskStates.stream().filter(dS -> diskName.equals(dS.name)).findFirst();
    // Validate boot DiskState against Azure osDisk
    {
        final OSDisk azureOsDisk = provisionedVM.storageProfile().osDisk();
        Optional<DiskState> bootDiskOpt = findDiskStateByName.apply(azureOsDisk.name());
        if (bootDiskOpt.isPresent()) {
            final DiskState bootDiskState = bootDiskOpt.get();
            assertNotNull("Azure OS Disk with name '" + azureOsDisk.name() + "' does not match any DiskState by name", bootDiskState);
            if (bootDiskState.customProperties != null && bootDiskState.customProperties.containsKey(AzureConstants.AZURE_MANAGED_DISK_TYPE)) {
                assertEquals("Boot DiskState.id does not match Azure managed disk id", azureOsDisk.managedDisk().id(), bootDiskState.id);
            } else {
                assertEquals("Boot DiskState.id does not match Azure.osDisk.vhd.uri", AzureUtils.canonizeId(azureOsDisk.vhd().uri()), bootDiskState.id);
            }
            assertEquals("OS Disk size of the VM in azure does not match with the intended size", AzureTestUtil.AZURE_CUSTOM_OSDISK_SIZE, azureOsDisk.diskSizeGB() * 1024);
        } else {
            fail("Mismatch in boot disk name.");
        }
    }
    for (DataDisk azureDataDisk : provisionedVM.storageProfile().dataDisks()) {
        Optional<DiskState> dataDiskOpt = findDiskStateByName.apply(azureDataDisk.name());
        if (dataDiskOpt.isPresent()) {
            DiskState dataDiskState = dataDiskOpt.get();
            assertNotNull("Azure Data Disk with name '" + azureDataDisk.name() + "' does not match any DiskState by name", dataDiskState);
            if (dataDiskState.customProperties != null && dataDiskState.customProperties.containsKey(AzureConstants.AZURE_MANAGED_DISK_TYPE)) {
                assertEquals("Data Disk State id does not match Azure managed disk id.", azureDataDisk.managedDisk().id(), dataDiskState.id);
            } else {
                assertEquals("Data Disk State id does not match Azure DataDisk.vhd.uri", AzureUtils.canonizeId(azureDataDisk.vhd().uri()), dataDiskState.id);
            }
            // assert size of each of the attached disks only in case of public image
            if (numberOfDataDisksOnImage == 0) {
                assertEquals("Mismatch in intended size of data disks " + azureDataDisk.name(), AZURE_CUSTOM_DATA_DISK_SIZE, azureDataDisk.diskSizeGB().longValue() * 1024);
            }
            assertEquals("LUN of DiskState does not match Azure.dataDisk.lun", String.valueOf(azureDataDisk.lun()), dataDiskState.customProperties.get(DISK_CONTROLLER_NUMBER));
        } else {
            fail("Data Disks not found.");
        }
    }
    assertEquals("Mismatch in number of data disks found on VM in azure", numberOfAdditionalDisks + numberOfDataDisksOnImage, provisionedVM.storageProfile().dataDisks().size());
}
Also used : NicSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs.NicSpec) NetworkManagementClientImpl(com.microsoft.azure.management.network.implementation.NetworkManagementClientImpl) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService) IpAssignment(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.IpAssignment) AzureTestUtil.deleteVMs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.deleteVMs) SHARED_NETWORK_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.SHARED_NETWORK_NIC_SPEC) VirtualNetworkInner(com.microsoft.azure.management.network.implementation.VirtualNetworkInner) DISK_CONTROLLER_NUMBER(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.DISK_CONTROLLER_NUMBER) AzureUriPaths(com.vmware.photon.controller.model.adapters.azure.AzureUriPaths) NetworkInterfaceStateWithDescription(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceStateWithDescription) ResourceGroupState(com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState) Map(java.util.Map) After(org.junit.After) StorageDescription(com.vmware.photon.controller.model.resources.StorageDescriptionService.StorageDescription) Assert.fail(org.junit.Assert.fail) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) OSDisk(com.microsoft.azure.management.compute.OSDisk) EnumSet(java.util.EnumSet) ResourceEnumerationTaskService(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService) AzureConstants(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants) DEFAULT_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.DEFAULT_NIC_SPEC) ComputeStatsResponse(com.vmware.photon.controller.model.adapterapi.ComputeStatsResponse) ComputeStatsRequest(com.vmware.photon.controller.model.adapterapi.ComputeStatsRequest) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) VMResourceSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.VMResourceSpec) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) UUID(java.util.UUID) AzureTestUtil.createPrivateImageSource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createPrivateImageSource) AzureTestUtil.createVMResourceFromSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createVMResourceFromSpec) Collectors(java.util.stream.Collectors) NO_PUBLIC_IP_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.NO_PUBLIC_IP_NIC_SPEC) List(java.util.List) AzureUtils(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils) AzureTestUtil.createImageSource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createImageSource) StorageDescriptionService(com.vmware.photon.controller.model.resources.StorageDescriptionService) UriUtils(com.vmware.xenon.common.UriUtils) Optional(java.util.Optional) NetworkSecurityGroupInner(com.microsoft.azure.management.network.implementation.NetworkSecurityGroupInner) AzureEnumerationAdapterService(com.vmware.photon.controller.model.adapters.azure.enumeration.AzureEnumerationAdapterService) TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) DiskService(com.vmware.photon.controller.model.resources.DiskService) AzureTestUtil.createDefaultResourceGroupState(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultResourceGroupState) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ResourceGroupStateType(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.ResourceGroupStateType) ResourceGroupInner(com.microsoft.azure.management.resources.implementation.ResourceGroupInner) PhotonModelMetricServices(com.vmware.photon.controller.model.PhotonModelMetricServices) Function(java.util.function.Function) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) AzureTestUtil.createDefaultVMResource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultVMResource) Level(java.util.logging.Level) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) Assume(org.junit.Assume) IMAGE_REFERENCE(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.IMAGE_REFERENCE) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner) AzureNicSpecs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs) PRIVATE_IP_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.PRIVATE_IP_NIC_SPEC) DataDisk(com.microsoft.azure.management.compute.DataDisk) Assert.assertNotNull(org.junit.Assert.assertNotNull) Operation(com.vmware.xenon.common.Operation) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ImageSource(com.vmware.photon.controller.model.adapters.util.instance.BaseComputeInstanceContext.ImageSource) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) AZURE_CUSTOM_DATA_DISK_SIZE(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AZURE_CUSTOM_DATA_DISK_SIZE) Assert.assertNull(org.junit.Assert.assertNull) Ignore(org.junit.Ignore) AzureTestUtil.generateName(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.generateName) Assert.assertEquals(org.junit.Assert.assertEquals) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) OSDisk(com.microsoft.azure.management.compute.OSDisk) DataDisk(com.microsoft.azure.management.compute.DataDisk) Optional(java.util.Optional) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState)

Aggregations

DiskState (com.vmware.photon.controller.model.resources.DiskService.DiskState)77 ArrayList (java.util.ArrayList)24 Operation (com.vmware.xenon.common.Operation)23 DiskService (com.vmware.photon.controller.model.resources.DiskService)18 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)16 List (java.util.List)15 EnumerationAction (com.vmware.photon.controller.model.adapterapi.EnumerationAction)13 UriUtils (com.vmware.xenon.common.UriUtils)13 Utils (com.vmware.xenon.common.Utils)13 HashMap (java.util.HashMap)13 TimeUnit (java.util.concurrent.TimeUnit)13 QueryTask (com.vmware.xenon.services.common.QueryTask)12 Query (com.vmware.xenon.services.common.QueryTask.Query)12 HashSet (java.util.HashSet)12 Test (org.junit.Test)11 AzureConstants (com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants)10 PhotonModelUriUtils.createInventoryUri (com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri)10 ServiceDocumentQueryResult (com.vmware.xenon.common.ServiceDocumentQueryResult)10 AuthCredentialsService (com.vmware.xenon.services.common.AuthCredentialsService)10 Map (java.util.Map)10