Summary
The vm_lifecycle tool currently supports start, stop, and restart actions but not pause or unpause. KubeVirt's pause/unpause functionality freezes a running VMI in place (preserving memory/CPU state), which is distinct from stop (which shuts down the VM entirely).
Problem
The KubeVirt pause/unpause API uses the subresources.kubevirt.io API group rather than the main kubevirt.io group:
PUT /apis/subresources.kubevirt.io/v1/namespaces/{ns}/virtualmachineinstances/{name}/pause
PUT /apis/subresources.kubevirt.io/v1/namespaces/{ns}/virtualmachineinstances/{name}/unpause
The AccessControlRoundTripper in pkg/kubernetes/accesscontrol_round_tripper.go validates all outgoing requests against the REST mapper. Since subresources.kubevirt.io is a virtual API group that doesn't appear in standard API discovery, the round tripper rejects requests to it with:
Validation Error [RESOURCE_NOT_FOUND]: Resource virtualmachineinstances.subresources.kubevirt.io does not exist in the cluster
This blocks the dynamic client from reaching the pause/unpause endpoints, even though the endpoints exist and work when called directly (e.g. via kubectl proxy).
Possible approaches
- Allowlist
subresources.kubevirt.io in the AccessControlRoundTripper -- skip REST mapper validation for known KubeVirt subresource API groups
- Bypass the round tripper for subresource calls -- use a separate HTTP client/REST client that doesn't go through the access control layer
- Use the KubeVirt client library directly -- import
kubevirt.io/client-go and use its typed client for pause/unpause
Context
The pause-vm eval task was removed in #1054 because the tool doesn't support pause. Once this is implemented, the eval task should be re-added.
/cc @ksimon1
Summary
The
vm_lifecycletool currently supportsstart,stop, andrestartactions but notpauseorunpause. KubeVirt's pause/unpause functionality freezes a running VMI in place (preserving memory/CPU state), which is distinct from stop (which shuts down the VM entirely).Problem
The KubeVirt pause/unpause API uses the
subresources.kubevirt.ioAPI group rather than the mainkubevirt.iogroup:The
AccessControlRoundTripperinpkg/kubernetes/accesscontrol_round_tripper.govalidates all outgoing requests against the REST mapper. Sincesubresources.kubevirt.iois a virtual API group that doesn't appear in standard API discovery, the round tripper rejects requests to it with:This blocks the dynamic client from reaching the pause/unpause endpoints, even though the endpoints exist and work when called directly (e.g. via
kubectl proxy).Possible approaches
subresources.kubevirt.ioin the AccessControlRoundTripper -- skip REST mapper validation for known KubeVirt subresource API groupskubevirt.io/client-goand use its typed client for pause/unpauseContext
The
pause-vmeval task was removed in #1054 because the tool doesn't support pause. Once this is implemented, the eval task should be re-added./cc @ksimon1