Azure / AKS-Edge

Welcome to the Azure Kubernetes Service (AKS) Edge repo.
MIT License
53 stars 34 forks source link

[Enhancement] Upgrade PowerShell cmdlets should perform a controller-based check for connected devices #154

Open erwinkersten opened 8 months ago

erwinkersten commented 8 months ago

The upgrade PowerShell cmdlets Start-AksEdgeControlPlaneUpdate and Start-AksEdgeWorkerNodeUpdate mount an ISO based on the function 'Add-IsoFileToVmmsVm'. In this function, a free LUN is detected, and a specific check is performed on connected DVD drives only.

[int[]]$luns = (Get-VMDvdDrive -VMName $vmName -ControllerNumber $controllerNumber).ControllerLocation

However, this check does not take into account other devices connected to the controller. I am aware that this is not a currently not an official supported scenario, but it would be better to perform this check on the scsi controller (instead of only DVD drives) to avoid conflicts. Background in our scenario we attach additional data disks to the VM, see also [Feature] Support for additional data disks for Single Machine Cluster these disk where added to the first available LUN and then this results in a conflict wile attaching the update iso.

Proposed fix:

[int[]]$luns = (Get-VMScsiController -VMName $vmName -ControllerNumber $controllerNumber).Drives.ControllerLocation

This small adjustment ensures a more comprehensive check on the controller, addressing potential conflicts caused by other connected devices.

Note: I registered this a as an Enhancement, as i couldn't find the PowerShell cmdlets in any public available repo to create a PR.