bootstrap: find the virtio CD by content, not by volume label

Get-Volume only returns a label when the image carries one; when it did
not, the whole block was skipped and neither vioser nor the agent was
installed. Probe the drives for guest-agent/qemu-ga-x86_64.msi instead.
This commit is contained in:
2026-10-26 13:01:10 -04:00
parent 0189330117
commit bcc370d70f
+13 -6
View File
@@ -64,14 +64,21 @@ if (-not (Get-NetFirewallRule -DisplayName 'Norbourg ICMPv4' -ErrorAction Silent
# virtio-win is attached as a CD on that platform; on qemu it is absent and
# this block does nothing.
try {
$virtio = Get-Volume -ErrorAction SilentlyContinue |
Where-Object { $_.FileSystemLabel -like 'virtio-win*' -and $_.DriveLetter } |
Select-Object -First 1
if ($virtio) {
# Find the virtio CD by its content, not by volume label: the label is
# not reliable across images and an empty one silently skipped the whole
# block (no driver, no agent, no provisioning).
$virtioRoot = $null
foreach ($drv in (Get-PSDrive -PSProvider FileSystem -ErrorAction SilentlyContinue)) {
if (Test-Path "$($drv.Root)guest-agent\qemu-ga-x86_64.msi") {
$virtioRoot = $drv.Root
break
}
}
if ($virtioRoot) {
# The agent MSI does not install the VirtIO serial driver. Without it
# the service starts but never connects to the channel, and Proxmox
# shows "guest agent is not running", which blocks provisioning.
$vioser = Get-ChildItem "$($virtio.DriveLetter):\vioserial" -Recurse -Filter 'vioser.inf' `
$vioser = Get-ChildItem "$($virtioRoot)vioserial" -Recurse -Filter 'vioser.inf' `
-ErrorAction SilentlyContinue |
Where-Object { $_.FullName -match 'amd64' } | Select-Object -First 1
if ($vioser) {
@@ -81,7 +88,7 @@ try {
Write-Host 'bootstrap: vioser.inf not found on the virtio CD'
}
$msi = "$($virtio.DriveLetter):\guest-agent\qemu-ga-x86_64.msi"
$msi = "$($virtioRoot)guest-agent\qemu-ga-x86_64.msi"
if (Test-Path $msi) {
Start-Process msiexec.exe -ArgumentList "/i `"$msi`" /qn /norestart" -Wait
Set-Service -Name QEMU-GA -StartupType Automatic -ErrorAction SilentlyContinue