feat: add -Detailed switch to Get-PveVm for accurate pause detection

PVE list endpoint reports Status=running for paused VMs. The new
-Detailed switch queries status/current per VM to populate QmpStatus.

- PveVm.EffectiveStatus computed property: returns QmpStatus ?? Status
- PveVm.Status doc comment explains the limitation
- VmService.EnrichVmStatus() queries status/current endpoint
- Get-PveVm -Detailed enriches each VM with qmpstatus, pid, uptime
- format.ps1xml table view uses EffectiveStatus for the Status column
- Integration test asserts EffectiveStatus after suspend/resume

Verified locally: Get-PveVm -Detailed correctly shows 'paused' for
suspended VMs where Get-PveVm (without -Detailed) shows 'running'.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-20 16:18:38 -05:00
parent 5e37737bc4
commit 8d5f33f592
5 changed files with 81 additions and 7 deletions
@@ -1153,14 +1153,19 @@ Describe 'Integration Tests' -Tag 'Integration' {
if (Skip-IfNoLinuxVm) { return }
# Suspend — -Wait -Timeout polls qmpstatus until 'paused'
# Note: PVE list endpoint reports Status=running for paused VMs;
# the -Wait polling uses the status/current endpoint which has qmpstatus.
$suspendTask = Suspend-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 30
$suspendTask | Should -Not -BeNullOrEmpty
# Verify with -Detailed (fetches qmpstatus from status/current endpoint)
$vm = Get-PveVm -Node $script:Node -VmId $script:LinuxVmId -Detailed
$vm.EffectiveStatus | Should -Be 'paused'
# Resume — -Wait -Timeout polls qmpstatus until 'running'
$resumeTask = Resume-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 30
$resumeTask | Should -Not -BeNullOrEmpty
$vm = Get-PveVm -Node $script:Node -VmId $script:LinuxVmId -Detailed
$vm.EffectiveStatus | Should -Be 'running'
}
It 'Should gracefully restart a VM via ACPI (Restart-PveVm)' {