/rh-virt:vm-snapshot-restorefrom rh-virt
Restore virtual machines from snapshots with strict safety confirmations to prevent data loss. Use when: - "Restore VM [name] from snapshot [snapshot-name]" - "Roll back VM [name] to snapshot" - "Recover VM [name] from backup" CRITICAL: Requires VM to be stopped and typed snapshot name confirmation before restore. NOT for creating snapshots (use vm-snapshot-create instead).
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.
Restore virtual machines from snapshots in OpenShift Virtualization. CRITICAL: This operation replaces current VM state with snapshot data. ALL changes since the snapshot will be LOST.
Implementation Note: This skill uses generic Kubernetes resource tools (resources_create_or_update) to create VirtualMachineRestore resources. Dedicated restore tools do not currently exist in the openshift-virtualization MCP server.
Required MCP Server: openshift-virtualization (OpenShift MCP Server)
Required MCP Tools:
resources_create_or_update (from openshift-virtualization) - Create VirtualMachineRestoreresources_get (from openshift-virtualization) - Verify VM/snapshot exists, monitor restorevm_lifecycle (from openshift-virtualization) - Stop VM if runningRequired 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-snapshot-create skillvm-snapshot-list skillvm-clone skillRequired Information from User:
If any information missing, ask for it.
MCP Tool: resources_get (from openshift-virtualization)
Parameters:
{
"apiVersion": "kubevirt.io/v1",
"kind": "VirtualMachine",
"namespace": "<namespace>",
"name": "<vm-name>"
}
Error Handling:
From the VM resource in Step 2, check status.printableStatus.
If VM is Running:
⚠️ VM Must Be Stopped Before Restore
**VM**: `<vm-name>` (namespace: `<namespace>`)
**Status**: Running
**Safety Requirement**: VMs must be stopped before restore to prevent data corruption.
**Options:**
1. "stop-and-restore" - Stop the VM first, then restore from snapshot
2. "cancel" - Cancel restore operation
How would you like to proceed?
Wait for user response.
MCP Tool: resources_get (from openshift-virtualization)
Parameters:
{
"apiVersion": "snapshot.kubevirt.io/v1beta1",
"kind": "VirtualMachineSnapshot",
"namespace": "<namespace>",
"name": "<snapshot-name>"
}
If snapshot not found:
❌ Snapshot Not Found
**Snapshot**: `<snapshot-name>` does not exist in namespace `<namespace>`.
**To list available snapshots:**
"List snapshots for VM <vm-name>"
Restore operation cancelled.
STOP workflow.
Extract snapshot details:
metadata.creationTimestamp - Creation timestatus.phase - Must be "Succeeded"status.readyToUse - Must be truespec.source.name - Verify it matches the VM nameIf snapshot status is not Ready:
❌ Snapshot Not Ready
**Snapshot**: `<snapshot-name>`
**Status**: <status.phase>
**Ready to Use**: <status.readyToUse>
Snapshot is not ready for restore. Only snapshots with "Succeeded" phase and readyToUse=true can be used.
Restore operation cancelled.
STOP workflow.
CRITICAL: User must type the snapshot name to confirm.
## 🔴 VM RESTORE - Data Loss Warning
**⚠️ THIS WILL REPLACE CURRENT VM STATE WITH SNAPSHOT DATA ⚠️**
### What Will Happen
**VM to Restore**: `<vm-name>` (namespace: `<namespace>`)
**Snapshot to Restore From**: `<snapshot-name>`
**Current VM State** (WILL BE LOST):
- **Last Modified**: <current-timestamp>
- **Changes Since Snapshot**: ALL changes made after <snapshot-creation-timestamp> WILL BE PERMANENTLY LOST
**Snapshot State** (WILL BE RESTORED):
- **Created**: <snapshot-creation-timestamp>
- **Age**: <snapshot-age>
**Time Range of Data Loss**:
- **⚠️ ALL CHANGES in the last <time-diff> WILL BE LOST ⚠️**
### What Will Be Restored
- ✓ VM configuration (from snapshot time)
- ✓ Disk data (from snapshot time)
### What Will Be Lost
- ✗ **ALL disk changes** made after <snapshot-creation-timestamp>
- ✗ **ALL configuration changes** made after <snapshot-creation-timestamp>
---
**⚠️ CRITICAL: This restore is permanent. Current VM state cannot be recovered unless you create a snapshot now.**
**To proceed with restore, type the snapshot name exactly as shown:**
Type `<snapshot-name>` to confirm: _____
Wait for user to type the snapshot name.
Validation:
On mismatch:
❌ Confirmation Failed
**You typed**: `<user-input>`
**Expected**: `<snapshot-name>`
Names do not match. Restore cancelled for safety.
Operation cancelled. Current VM state preserved.
STOP workflow.
After typed verification succeeds, ask for final explicit confirmation.
## ✓ Typed Verification Passed
**Confirmation received for snapshot**: `<snapshot-name>`
### Ready to Restore
**VM**: `<vm-name>` (namespace: `<namespace>`)
**From Snapshot**: `<snapshot-name>`
**Impact**:
- Current VM state will be replaced with snapshot state
- All changes in the last <time-diff> will be permanently lost
---
**Proceed with VM restore? This action cannot be undone.**
- Type "yes" to execute restore
- Type "cancel" to abort
Your choice: _____
Wait for user response.
Handle response:
On cancellation:
Restore operation cancelled by user. Current VM state preserved.
STOP workflow.
ONLY PROCEED AFTER:
MCP Tool: resources_create_or_update (from openshift-virtualization)
Construct VirtualMachineRestore YAML:
apiVersion: snapshot.kubevirt.io/v1beta1
kind: VirtualMachineRestore
metadata:
name: <restore-name>
namespace: <namespace>
spec:
target:
apiGroup: kubevirt.io
kind: VirtualMachine
name: <vm-name>
virtualMachineSnapshotName: <snapshot-name>
Generate restore name:
restore-<vm-name>-<timestamp>restore-database-01-20260218-143500Parameters:
{
"resource": "apiVersion: snapshot.kubevirt.io/v1beta1\nkind: VirtualMachineRestore\nmetadata:\n name: <restore-name>\n namespace: <namespace>\nspec:\n target:\n apiGroup: kubevirt.io\n kind: VirtualMachine\n name: <vm-name>\n virtualMachineSnapshotName: <snapshot-name>"
}
Report progress:
🔄 Restoring VM from snapshot...
⏳ This may take several minutes...
Use resources_get to monitor VirtualMachineRestore status.
Check status.complete:
true → Restore completedfalse → Restore in progressWait up to 10 minutes for restore to complete.
On success:
## ✓ VM Restored Successfully
**VM**: `<vm-name>` (namespace: `<namespace>`)
**Restored From**: Snapshot `<snapshot-name>`
### Restore Details
- **Snapshot Created**: <snapshot-creation-timestamp>
- **Restore Completed**: <current-timestamp>
- **VM Status**: Stopped (ready to start)
### Data Loss Confirmation
- ⚠️ All changes made after <snapshot-creation-timestamp> have been lost
### Next Steps
**To start the restored VM:**
"Start VM <vm-name> in namespace <namespace>"
On failure:
## ❌ VM Restore Failed
**Error**: <error-message>
**VM**: `<vm-name>`
**Snapshot**: `<snapshot-name>`
**Current VM State**: UNKNOWN - may be partially restored or unchanged
**CRITICAL**: Do not start VM until restore issue is resolved
**Recovery Options:**
1. Try restore again after resolving the error
2. Restore from a different snapshot
3. Contact cluster admin for investigation
openshift-virtualization - OpenShift MCP server with kubevirt toolsetresources_create_or_update (from openshift-virtualization) - Create VirtualMachineRestoreresources_get (from openshift-virtualization) - Verify and monitorvm_lifecycle (from openshift-virtualization) - Stop VM if runningvm-snapshot-list - List snapshots before restorevm-snapshot-create - Create snapshots before risky operationsvm-snapshot-delete - Delete old snapshotsvm-lifecycle-manager - Start VM after restoreOfficial Red Hat Documentation:
Upstream Documentation:
IMPORTANT: This skill performs DESTRUCTIVE operations. You MUST:
Before Restoring Snapshots (CRITICAL - Data Loss Risk)
Never Auto-Execute
Why This Matters:
Error: "Failed to restore: insufficient storage capacity" or "PVC provisioning failed"
Cause: The namespace doesn't have enough storage quota or the storage backend is full.
Solution:
resources_list with kind="ResourceQuota"resources_list for PersistentVolumeClaimsError: VirtualMachineRestore status shows complete: false for extended period
Cause: The storage backend is slow, the snapshot is corrupted, or there's a CSI driver issue.
Solution:
status.conditions for detailed error messagesError: "Confirmation Failed - Names do not match"
Cause: User made a typo when typing the snapshot name for confirmation.
Solution:
This safety mechanism is intentional - it prevents accidental data loss from restoring to the wrong snapshot.
User: "The database upgrade failed. Restore database-01 from snapshot pre-upgrade-snapshot"
Agent: "Which namespace is database-01 in?"
User: "production"
Agent: [Verifies VM - Running status detected] "⚠️ VM Must Be Stopped Before Restore. Options: 1) stop-and-restore 2) cancel"
User: "stop-and-restore"
Agent: [Stops VM, verifies snapshot exists] "🔴 VM RESTORE - Data Loss Warning
pre-upgrade-snapshot to confirm: _____"User: "pre-upgrade-snapshot"
Agent: "✓ Typed Verification Passed. Proceed with restore? (yes/cancel)"
User: "yes"
Agent: "🔄 Restoring VM from snapshot... ⏳ This may take several minutes..." [Monitors progress] "✓ VM Restored Successfully
To start: 'Start VM database-01 in namespace production'"
What SKILL.md sets; muted values are Claude Code's defaults
inheritOther plugins' skills for the same job
npx claudepluginhub rhecosystemappeng/agentic-catalog --plugin rh-virt10 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-