trycua/cua

[Lume] VM Snapshot Management

Open

#15 geöffnet am 5. Feb. 2025

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)HTML (1.051 Forks)batch import
good first issue

Repository-Metriken

Stars
 (16.722 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 1T 9h) (119 gemergte PRs in 30 T)

Beschreibung

Current Behavior

Currently lume does not support creating, managing, or restoring VM snapshots.

Desired Behavior

Ability to:

  • Create named snapshots of running or stopped VMs
  • List available snapshots for a VM
  • Restore VMs to previous snapshots
  • Delete snapshots
  • Export/Import snapshots

Technical Implementation

macOS Virtualization.Framework already provides snapshot support through VZMacOSVirtualMachineSnapshot class, which offers:

  • VZMacOSVirtualMachine.takeSnapshot() - Creates a snapshot of the current VM state
  • VZMacOSVirtualMachine.restoreSnapshot(_:) - Restores VM to a previous snapshot
  • Snapshot data can be written to disk using write(toFile:) and loaded using init(contentsOf:)

This native support makes implementation straightforward, mainly requiring:

  1. CLI interface to expose snapshot functions
  2. Snapshot management system
  3. Storage handling for snapshot files

Proposed CLI Commands

# Create snapshot
lume snapshot create <vm-name> [--name <snapshot-name>]

# List snapshots
lume snapshot list <vm-name>

# Restore snapshot
lume snapshot restore <vm-name> <snapshot-name>

# Delete snapshot
lume snapshot delete <vm-name> <snapshot-name>

# Export snapshot
lume snapshot export <vm-name> <snapshot-name> <output-path>

# Import snapshot
lume snapshot import <vm-name> <snapshot-path>

Contributor Guide