mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-07-25 08:54:43 +00:00
feat(kubevirt_vm): add state=start/stop/restart to manage VM lifecycle
It adds support for starting, stopping, and restarting VirtualMachines. The operations are performed through the KubeVirt restart subresource API (PUT to `subresources.kubevirt.io/v1`). These calls are extracted into a single shared helper function `_call_subresource()` to handle the common flow, i.e., check mode, API call and wait conditions. Moreover, it adds the optional parameter `grace_period_seconds` for stop and start operations. Additionally, it adds unit tests and integration tests for all operations. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Javier Cano Cano <jcanocan@redhat.com>
This commit is contained in:
10
examples/play-start.yml
Normal file
10
examples/play-start.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: Playbook starting a virtual machine
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: Start VM
|
||||
kubevirt.core.kubevirt_vm:
|
||||
state: started
|
||||
name: testvm
|
||||
namespace: default
|
||||
wait: true
|
||||
Reference in New Issue
Block a user