chore: retry stalled Windows Update online catalog search (#2507)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-07 13:45:35 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 66c35b6783
commit 4063c3800d
3 changed files with 61 additions and 11 deletions
+1 -3
View File
@@ -61,9 +61,7 @@ $volume = Invoke-WithVhdLock {
if ($disk.PhysicalSectorSize -gt 4096) {
throw "SQL Server fixture disk exposes unsupported physical sectors"
}
$disk | Initialize-Disk -PartitionStyle GPT -PassThru |
New-Partition -UseMaximumSize -AssignDriveLetter |
Format-Volume -FileSystem NTFS -NewFileSystemLabel CISQL -Confirm:$false
Format-NewDisk $disk CISQL
}
$instanceDir = "$($volume.DriveLetter):\SQLServer"
fsutil.exe fsinfo sectorinfo "$($volume.DriveLetter):"
+19
View File
@@ -18,3 +18,22 @@ function Invoke-WithVhdLock([scriptblock]$ScriptBlock) {
$mutex.Dispose()
}
}
# New-Partition can return before the storage provider exposes the new volume,
# which makes Format-Volume fail with CmdletizationQuery_NotFound. Retry until
# the volume appears.
function Format-NewDisk($Disk, [string]$Label) {
$partition = $Disk | Initialize-Disk -PartitionStyle GPT -PassThru |
New-Partition -UseMaximumSize -AssignDriveLetter
$deadline = (Get-Date).AddSeconds(30)
while ($true) {
try {
return $partition | Format-Volume -FileSystem NTFS -NewFileSystemLabel $Label -Confirm:$false
} catch {
if ($_.FullyQualifiedErrorId -notlike "CmdletizationQuery_NotFound*" -or (Get-Date) -ge $deadline) {
throw
}
Start-Sleep -Seconds 1
}
}
}