trycua/cua

[Lume] VM Snapshot Management

Open

#15 建立於 2025年2月5日

在 GitHub 查看
 (1 留言) (1 反應) (0 負責人)HTML (1,051 fork)batch import
good first issue

倉庫指標

Star
 (16,722 star)
PR 合併指標
 (平均合併 1天 9小時) (30 天內合併 119 個 PR)

描述

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>

貢獻者指南