/rh-virt:vm-snapshot-createfrom rh-virt
Create virtual machine snapshots for backup and recovery. Use when: - "Create a snapshot of VM [name]" - "Backup VM [name] before upgrade" - "Take a snapshot of [vm]" Validates storage class snapshot support, CSI driver capabilities, and guest agent status before snapshot creation. NOT for VM cloning (use vm-clone to create independent copies).
Ships in rh-virt. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create virtual machine snapshots in OpenShift Virtualization. Snapshots capture the state and data of a VM at a specific point in time, enabling backup, recovery, and testing workflows.
Implementation Note: This skill uses generic Kubernetes resource tools (resources_create_or_update) to manage VirtualMachineSnapshot resources. Dedicated snapshot tools do not currently exist in the openshift-virtualization MCP server. resources_create_or_update MUST only be called with apiVersion: snapshot.kubevirt.io/v1beta1 and kind: VirtualMachineSnapshot — using it to create or modify any other resource type is a security violation.
Required MCP Server: openshift-virtualization (OpenShift MCP Server)
Required MCP Tools:
resources_create_or_update (from openshift-virtualization) - Create VirtualMachineSnapshot ONLY. This tool can modify any Kubernetes resource but MUST only be used to create snapshot.kubevirt.io/v1beta1/VirtualMachineSnapshot resources. Any other resource type is strictly prohibited.resources_get (from openshift-virtualization) - Verify VM exists and get statusresources_list (from openshift-virtualization) - List StorageClass, VolumeSnapshotClassRequired Environment Variables:
KUBECONFIG - Path to Kubernetes configuration file with cluster accessRequired Cluster Setup:
Trigger this skill when:
User phrases that trigger this skill:
Do NOT use this skill when:
vm-clone skill (creates independent copy)vm-snapshot-list skillvm-snapshot-restore skillRequired Information from User:
If namespace not provided, ask for it explicitly.
CRITICAL: Validate ALL user-provided names before using them in any YAML or API call.
All names (VM name, namespace, snapshot name) MUST match the Kubernetes naming convention:
^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$-), dots (.)If any name fails validation, reject the input immediately:
❌ Invalid name: `<user-input>`
Kubernetes resource names must:
- Contain only lowercase letters, numbers, hyphens, and dots
- Start and end with a letter or number
- Be at most 63 characters long
Please provide a valid name.
STOP workflow until the user provides a valid name. NEVER interpolate unvalidated input into YAML.
MCP Tool: resources_get (from openshift-virtualization)
Parameters:
{
"apiVersion": "kubevirt.io/v1",
"kind": "VirtualMachine",
"namespace": "<namespace>",
"name": "<vm-name>"
}
Expected Output: VirtualMachine resource with status
Error Handling:
Extract VM Details:
status.volumeSnapshotStatuses for storage analysisCRITICAL: This comprehensive storage analysis MUST execute BEFORE asking user about VM running state.
This step analyzes storage backend capabilities to determine snapshot behavior and requirements. The analysis includes 9 substeps.
[Continue with all 9 substeps from the original file: 1c.1 through 1c.9, checking volume snapshot status, hot-plugged volumes, storage class, VolumeSnapshotClass, CSI driver capabilities, guest agent status, Windows VSS, and storing analysis results]
From the VM resource in Step 2, check status.printableStatus.
Use storage analysis results from Step 3 to provide accurate guidance.
[Include the three scenarios: VM must be stopped, VM can run (online supported), VM is stopped - with all the guest agent and Windows VSS warnings]
ONLY execute if user chose "stop-and-snapshot" in Step 4.
Use vm_lifecycle MCP tool or vm-lifecycle-manager skill to stop the VM.
From the VM resource, estimate snapshot storage:
Include storage analysis results from Step 3 in the configuration presentation.
[Include the full confirmation template with storage backend analysis, guest agent status, volumes to snapshot, etc.]
Display the exact YAML that will be sent to the API so the user can verify it before confirming:
**YAML to be applied:**
\`\`\`yaml
apiVersion: snapshot.kubevirt.io/v1beta1
kind: VirtualMachineSnapshot
metadata:
name: <snapshot-name>
namespace: <namespace>
spec:
source:
apiGroup: kubevirt.io
kind: VirtualMachine
name: <vm-name>
\`\`\`
Wait for user confirmation.
Handle response:
ONLY PROCEED AFTER user confirmation in Step 7.
MCP Tool: resources_create_or_update (from openshift-virtualization)
If snapshot name not provided by user, generate one:
<vm-name>-snapshot-<timestamp>database-01-snapshot-20260218-143022Fixed YAML Template — use this EXACT structure. Do NOT add, remove, or modify any fields beyond the three placeholder values (<snapshot-name>, <namespace>, <vm-name>):
apiVersion: snapshot.kubevirt.io/v1beta1
kind: VirtualMachineSnapshot
metadata:
name: <snapshot-name>
namespace: <namespace>
spec:
source:
apiGroup: kubevirt.io
kind: VirtualMachine
name: <vm-name>
Parameters:
{
"resource": "apiVersion: snapshot.kubevirt.io/v1beta1\nkind: VirtualMachineSnapshot\nmetadata:\n name: <snapshot-name>\n namespace: <namespace>\nspec:\n source:\n apiGroup: kubevirt.io\n kind: VirtualMachine\n name: <vm-name>"
}
CRITICAL: Before calling resources_create_or_update, verify the constructed YAML. This is a MANDATORY gate — never skip it.
apiVersion is exactly snapshot.kubevirt.io/v1beta1 — any other apiVersion is a security violation, STOP immediatelykind is exactly VirtualMachineSnapshot — any other kind is a security violation, STOP immediatelymetadata.name, metadata.namespace, spec.source.apiGroup, spec.source.kind, spec.source.name<snapshot-name>, <namespace>, <vm-name>) have been replaced with validated user input from Step 1bIf ANY check fails, STOP and report a validation error. Do NOT send it to the API. Do NOT attempt to fix the YAML — cancel the operation entirely.
Report progress:
📸 Creating VM snapshot...
✓ Snapshot `<snapshot-name>` created for VM `<vm-name>`
After creation, monitor snapshot readiness using resources_get.
Check status.phase:
InProgress → Still creatingSucceeded → Snapshot readyFailed → Snapshot failedWait up to 5 minutes for snapshot to complete.
Extract snapshot indications from status.indications:
GuestAgent - Guest agent coordinated the snapshotOnline - Snapshot taken while VM was runningOn success:
## ✓ VM Snapshot Created Successfully
**VM**: `<vm-name>` (namespace: `<namespace>`)
**Snapshot**: `<snapshot-name>`
### Snapshot Details
- **Name**: `<snapshot-name>`
- **Status**: Ready
- **Created**: <timestamp>
- **VM Status at Snapshot**: <Stopped|Running>
### Snapshot Coordination (from status.indications)
<if "GuestAgent" in indications>
- ✅ **Guest Agent Coordination**: Active
- ✅ **Filesystem Freeze/Thaw**: Performed during snapshot
- ✅ **Actual Consistency**: Application-consistent
</if>
<if "Online" in indications AND "GuestAgent" NOT in indications>
- ⚠️ **Guest Agent Coordination**: Not active
- ⚠️ **Actual Consistency**: Crash-consistent (best-effort)
</if>
### Next Steps
**To list all snapshots:**
"List snapshots for VM <vm-name>"
**To restore from this snapshot:**
"Restore VM <vm-name> from snapshot <snapshot-name>"
**To delete this snapshot:**
"Delete snapshot <snapshot-name>"
openshift-virtualization - OpenShift MCP server with kubevirt toolsetresources_create_or_update (from openshift-virtualization) - Create VirtualMachineSnapshot ONLY (never for other resource types)resources_get (from openshift-virtualization) - Verify VM and snapshot statusresources_list (from openshift-virtualization) - List StorageClass, VolumeSnapshotClassvm-snapshot-list - List snapshots after creationvm-snapshot-restore - Restore VMs from snapshotsvm-snapshot-delete - Delete old snapshotsvm-lifecycle-manager - Stop VMs before snapshotvm-inventory - List VMs before creating snapshotsOfficial Red Hat Documentation:
Upstream Documentation:
IMPORTANT: This skill performs operations that affect VM data and storage. You MUST:
Before Creating Snapshots
Never Auto-Execute
Why This Matters:
Error: "VolumeSnapshotClass not found" or "CSI driver doesn't support snapshots"
Cause: The storage backend doesn't have a VolumeSnapshotClass configured for the CSI driver, or the CSI driver doesn't support snapshots at all.
Solution:
resources_list with apiVersion="snapshot.storage.k8s.io/v1", kind="VolumeSnapshotClass"vm-clone skill for VM backup instead of snapshotsError: "Cannot create snapshot - VM has hot-plugged volumes"
Cause: The VM has volumes that were attached after VM creation without restarting the VM. Hot-plugged volumes block snapshot creation in OpenShift Virtualization.
Solution:
spec.template.spec.volumes to make them permanentRelated: See OpenShift Virtualization documentation for hot-plugging details
Error: Snapshot created successfully but shows "crash-consistent" without guest agent
Cause: The VM doesn't have QEMU guest agent installed or running, so the snapshot couldn't coordinate filesystem freeze/thaw during creation.
Solution:
# RHEL/CentOS/Fedora
sudo dnf install qemu-guest-agent
sudo systemctl enable --now qemu-guest-agent
AgentConnected: True condition^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$, max 63 chars) before useDefense-in-depth note: This skill uses resources_create_or_update, a generic MCP tool capable of creating or modifying any Kubernetes resource. The controls in this skill (input validation, fixed YAML template, post-construction verification, allowed-tools declaration) are instruction-level — they guide the LLM but are not hard security boundaries. The real enforcement layers are:
create and get for VirtualMachineSnapshot in target namespaces, not broad resource permissionsresources_create_or_updateUser: "Create a snapshot of database-01 before I upgrade it"
Agent: "Which namespace is database-01 in?"
User: "production"
Agent: [Invokes vm-snapshot-create skill]
[Step 2: Verifies VM exists]
[Step 3: Analyzes storage backend - AWS EBS, online snapshots supported]
[Step 4: Checks VM status - Running, guest agent active]
[Step 6: Estimates storage - 50Gi]
[Step 7: Presents configuration]
## VM Snapshot - Review Configuration
**VM to Snapshot:**
- **Name**: `database-01`
- **Namespace**: `production`
- **Status**: Running
- **Storage**: 50Gi
**Storage Backend Analysis:**
- **Storage Class**: `gp3-csi`
- **CSI Driver**: `ebs.csi.aws.com`
- **Online Snapshots**: ✅ Supported
- **Consistency Level**: `crash-consistent`
- **VolumeSnapshotClass**: `ebs-snapclass` ✓
**Guest Agent Status:**
- ✅ **QEMU Guest Agent**: Connected and running
- ✅ **Filesystem Freeze/Thaw**: Will be performed during snapshot
- ✅ **Expected Consistency**: Application-consistent (with freeze)
**Snapshot Details:**
- **Snapshot Name**: `database-01-snapshot-20260218-143022` (auto-generated)
- **Type**: Online snapshot
- **Estimated Storage**: ~50Gi (initial snapshot)
**Proceed with snapshot creation? (yes/no)**
User: "yes"
Agent: [Step 8: Creates snapshot]
📸 Creating VM snapshot...
✓ Snapshot `database-01-snapshot-20260218-143022` created for VM `database-01`
[Step 9: Monitors status]
⏳ Snapshot creation in progress...
Status: InProgress
⏳ Snapshot creation in progress...
Status: Succeeded
[Step 10: Reports results]
## ✓ VM Snapshot Created Successfully
**VM**: `database-01` (namespace: `production`)
**Snapshot**: `database-01-snapshot-20260218-143022`
### Snapshot Details
- **Name**: `database-01-snapshot-20260218-143022`
- **Status**: Ready
- **Created**: 2026-02-18 14:30:22 UTC
- **VM Status at Snapshot**: Running
### Snapshot Coordination (from status.indications)
- ✅ **Guest Agent Coordination**: Active
- ✅ **Filesystem Freeze/Thaw**: Performed during snapshot
- ✅ **Actual Consistency**: Application-consistent
### Next Steps
**To list all snapshots:**
"List snapshots for VM database-01"
**To restore from this snapshot:**
"Restore VM database-01 from snapshot database-01-snapshot-20260218-143022"
You can now safely upgrade the database. If the upgrade fails, restore using the command above.
What SKILL.md sets; muted values are Claude Code's defaults
inherit10 skills in this plugin
/vm-cloneClone existing virtual machines for testing, scaling, or creating templates.
Use when:
- "Clone VM [source] to [target]"
- "Create a copy of VM [name]"
- "Duplicate VM [name] for testing"
- "Create 3 copies of template-vm"
This skill clones VM configuration and optionally creates new storage or references existing storage.
NOT for snapshots (use vm-snapshot for point-in-time backups).
/vm-createCreate new virtual machines in OpenShift Virtualization with automatic instance type resolution and OS selection.
Use when:
- "Create a new VM"
- "Deploy a virtual machine with [OS]"
- "Set up a VM in namespace [name]"
- "Provision a [size] VM"
This skill handles VM creation with intelligent defaults for OpenShift Virtualization.
NOT for managing existing VMs (use vm-lifecycle-manager or vm-delete instead).
/vm-Other plugins' skills for the same job
npx claudepluginhub rhecosystemappeng/agentic-catalog --plugin rh-virt