Search in sources :

Example 1 with VirtualMachineScaleSetManagedDiskParameters

use of com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetImpl method setOSDiskDefault.

private void setOSDiskDefault() {
    if (isInUpdateMode()) {
        return;
    }
    VirtualMachineScaleSetStorageProfile storageProfile = this.inner().virtualMachineProfile().storageProfile();
    VirtualMachineScaleSetOSDisk osDisk = storageProfile.osDisk();
    if (isOSDiskFromImage(osDisk)) {
        //
        if (isManagedDiskEnabled()) {
            //
            if (osDisk.managedDisk() == null) {
                osDisk.withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters());
            }
            if (osDisk.managedDisk().storageAccountType() == null) {
                osDisk.managedDisk().withStorageAccountType(StorageAccountTypes.STANDARD_LRS);
            }
            osDisk.withVhdContainers(null);
        // We won't set osDisk.name() explicitly for managed disk, if it is null CRP generates unique
        // name for the disk resource within the resource group.
        } else {
            // Note:
            // Native (un-managed) disk
            //     Supported: PlatformImage and StoredImage
            //     UnSupported: CustomImage
            //
            osDisk.withManagedDisk(null);
            if (osDisk.name() == null) {
                withOSDiskName(this.name() + "-os-disk");
            }
        }
    } else {
    // NOP [ODDisk CreateOption: ATTACH, ATTACH is not supported for VMSS]
    }
    if (this.osDiskCachingType() == null) {
        withOSDiskCaching(CachingTypes.READ_WRITE);
    }
}
Also used : VirtualMachineScaleSetOSDisk(com.microsoft.azure.management.compute.VirtualMachineScaleSetOSDisk) VirtualMachineScaleSetStorageProfile(com.microsoft.azure.management.compute.VirtualMachineScaleSetStorageProfile) VirtualMachineScaleSetManagedDiskParameters(com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters)

Example 2 with VirtualMachineScaleSetManagedDiskParameters

use of com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetImpl method withNewDataDiskFromImage.

@Override
public VirtualMachineScaleSetImpl withNewDataDiskFromImage(int imageLun, int newSizeInGB, CachingTypes cachingType, StorageAccountTypes storageAccountType) {
    VirtualMachineScaleSetManagedDiskParameters managedDiskParameters = new VirtualMachineScaleSetManagedDiskParameters();
    managedDiskParameters.withStorageAccountType(storageAccountType);
    this.managedDataDisks.newDisksFromImage.add(new VirtualMachineScaleSetDataDisk().withLun(imageLun).withDiskSizeGB(newSizeInGB).withManagedDisk(managedDiskParameters).withCaching(cachingType));
    return this;
}
Also used : VirtualMachineScaleSetManagedDiskParameters(com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters) VirtualMachineScaleSetDataDisk(com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)

Example 3 with VirtualMachineScaleSetManagedDiskParameters

use of com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetImpl method withNewDataDisk.

@Override
public VirtualMachineScaleSetImpl withNewDataDisk(int sizeInGB, int lun, CachingTypes cachingType, StorageAccountTypes storageAccountType) {
    throwIfManagedDiskDisabled(ManagedUnmanagedDiskErrors.VMSS_BOTH_UNMANAGED_AND_MANAGED_DISK_NOT_ALLOWED);
    VirtualMachineScaleSetManagedDiskParameters managedDiskParameters = new VirtualMachineScaleSetManagedDiskParameters();
    managedDiskParameters.withStorageAccountType(storageAccountType);
    this.managedDataDisks.implicitDisksToAssociate.add(new VirtualMachineScaleSetDataDisk().withLun(lun).withDiskSizeGB(sizeInGB).withCaching(cachingType).withManagedDisk(managedDiskParameters));
    return this;
}
Also used : VirtualMachineScaleSetManagedDiskParameters(com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters) VirtualMachineScaleSetDataDisk(com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)

Aggregations

VirtualMachineScaleSetManagedDiskParameters (com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters)3 VirtualMachineScaleSetDataDisk (com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)2 VirtualMachineScaleSetOSDisk (com.microsoft.azure.management.compute.VirtualMachineScaleSetOSDisk)1 VirtualMachineScaleSetStorageProfile (com.microsoft.azure.management.compute.VirtualMachineScaleSetStorageProfile)1