Search in sources :

Example 1 with VirtualMachineScaleSetDataDisk

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

the class VirtualMachineScaleSetImpl method withNewDataDisk.

@Override
public VirtualMachineScaleSetImpl withNewDataDisk(int sizeInGB) {
    throwIfManagedDiskDisabled(ManagedUnmanagedDiskErrors.VMSS_BOTH_UNMANAGED_AND_MANAGED_DISK_NOT_ALLOWED);
    this.managedDataDisks.implicitDisksToAssociate.add(new VirtualMachineScaleSetDataDisk().withLun(-1).withDiskSizeGB(sizeInGB));
    return this;
}
Also used : VirtualMachineScaleSetDataDisk(com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)

Example 2 with VirtualMachineScaleSetDataDisk

use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk 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 VirtualMachineScaleSetDataDisk

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

the class VirtualMachineScaleSetUnmanagedDataDiskImpl method setDataDisksDefaults.

protected static void setDataDisksDefaults(List<VirtualMachineScaleSetDataDisk> dataDisks, String namePrefix) {
    if (dataDisks == null) {
        return;
    }
    List<Integer> usedLuns = new ArrayList<>();
    for (VirtualMachineScaleSetDataDisk dataDisk : dataDisks) {
        if (dataDisk.lun() != -1) {
            usedLuns.add(dataDisk.lun());
        }
    }
    for (VirtualMachineScaleSetDataDisk dataDisk : dataDisks) {
        if (dataDisk.lun() == -1) {
            Integer i = 0;
            while (usedLuns.contains(i)) {
                i++;
            }
            dataDisk.withLun(i);
            usedLuns.add(i);
        }
        if (dataDisk.name() == null) {
            dataDisk.withName(namePrefix + "-data-disk-" + dataDisk.lun());
        }
        if (dataDisk.caching() == null) {
            dataDisk.withCaching(CachingTypes.READ_WRITE);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) VirtualMachineScaleSetDataDisk(com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)

Example 4 with VirtualMachineScaleSetDataDisk

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

the class VirtualMachineScaleSetUnmanagedDataDiskImpl method prepareDataDisk.

protected static VirtualMachineScaleSetUnmanagedDataDiskImpl prepareDataDisk(String name, VirtualMachineScaleSetImpl parent) {
    VirtualMachineScaleSetDataDisk dataDiskInner = new VirtualMachineScaleSetDataDisk();
    dataDiskInner.withLun(-1).withName(name);
    return new VirtualMachineScaleSetUnmanagedDataDiskImpl(dataDiskInner, parent);
}
Also used : VirtualMachineScaleSetDataDisk(com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)

Example 5 with VirtualMachineScaleSetDataDisk

use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk 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

VirtualMachineScaleSetDataDisk (com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk)5 VirtualMachineScaleSetManagedDiskParameters (com.microsoft.azure.management.compute.VirtualMachineScaleSetManagedDiskParameters)2 ArrayList (java.util.ArrayList)1