Esri / arcgis-powershell-dsc

This repository contains scripts, code and samples for automating the install and configuration of ArcGIS (Enterprise and Desktop) using Microsoft Windows PowerShell DSC (Desired State Configuration).
Apache License 2.0
110 stars 61 forks source link

ArcGIS_xDisk.psm1 has DataDisk hardcoded as DiskNumber =2, but this is not present on VMs that do not have a temporary disk. #510

Closed mundayn closed 1 month ago

mundayn commented 6 months ago

Module Version

ModuleVersion = '4.2.0'

Affected Resource(s)

ArcGIS Enterprise Cloud Builder 11.2 for Microsoft Azure

Configuration Files

n/a for now

Expected Behavior

I deployed a VM using Standard_D8as_v5, but this SKU does not have a temporary disk.

I redeployed using Standard_D8ds_v5, which has a temp disk, and it works. (well it got further, but that's another issue)

I looked at the PowerShell files and found this hard coded - “ArcGIS_xDisk.psm1” image

When I run 'Get-Disk' on the other SKU, it only had disk 0 and 1, no disk 2. When changing SKU, this is resolved, as disk 2 is now the data disk.

There needs to be logic added to check for this scenario.

Actual Behavior

Error message: "DSC Configuration 'BaseDeploymentSingleTierConfiguration' completed with error(s). Following are the first few: No MSFT_Disk objects found with property 'Number' equal to '2'.

Steps to Reproduce

Build a VM with a SKU with no temp disk.

AndrewQuartic commented 3 months ago

I noticed the following template contains additional logic for formatting and partitioning: https://github.com/Esri/arcgis-powershell-dsc/blob/main/Modules/ArcGIS/Configurations-Azure/DiskConfiguration.ps1

However, it contains the same hardcoded integer value assuming that a temp disk is always present. Do we assume that partition happens before the basedeployment DSC configuration is run?

cameronkroeker commented 1 month ago

@AndrewQuartic Thanks! This has been addressed in ArcGIS Enterprise Cloud Builder 11.3 for Microsoft Azure.

AndrewQuartic commented 4 weeks ago

@cameronkroeker This issue is not yet addressed, we just forked and attempted again using a VM SKU without temp disk and the result was the same.

AndrewQuartic commented 4 weeks ago

We are proposing the following code fix:

$UnallocatedDataDisks = Get-Disk | Where-Object partitionstyle -eq 'raw' | Sort-Object number
# Initialize an array of disks starting with F
$Letters = 70. .89 | ForEach - Object {
    [char] $_
}
$Count = 0

# iterate though unallocated disks and partition each in sequence ordered by disk number
foreach($Disk in $UnallocatedDataDisks) {
    $DataDiskDriveLetter = $Letters[$Count].ToString()
    ArcGIS_xDisk DataDisk$ {
        DataDiskDriveLetter
    } {
        DiskNumber = $Disk.number
        DriveLetter = $DataDiskDriveLetter
    }
    if (Get - Partition - DriveLetter $DataDiskDriveLetter - ErrorAction Ignore) {
        ArcGIS_Disk DataDiskSize {
            DriveLetter = $DataDiskDriveLetter
            SizeInGB = 4095
            DependsOn = $Depends
        }
    }
    $Depends += "[ArcGIS_xDisk]DataDisk${DataDiskDriveLetter}"
    $Count++
}
cameronkroeker commented 4 weeks ago

@cameronkroeker This issue is not yet addressed, we just forked and attempted again using a VM SKU without temp disk and the result was the same.

It didn't work using ArcGIS Enterprise Cloud Builder 11.3 for Microsoft Azure or didn't work using the DSC ArcGIS Module directly? Just want to verify because it is not designed to work outside of CloudBuilder.