Skip to content

Refactor/disk info base disk v7 schema#335

Merged
DorianZheng merged 3 commits intomainfrom
refactor/disk-info-base-disk-v7-schema
Mar 4, 2026
Merged

Refactor/disk info base disk v7 schema#335
DorianZheng merged 3 commits intomainfrom
refactor/disk-info-base-disk-v7-schema

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

No description provided.

DorianZheng and others added 3 commits March 3, 2026 23:18
Extract shared disk metadata (path, sizes) into a serializable `DiskInfo`
struct embedded via `#[serde(flatten)]` in `BaseDisk` and `SnapshotInfo`.
This centralizes disk metadata that was previously duplicated across
snapshot and clone types.

Key changes:
- Add `DiskInfo` DTO with `From<&Disk>` / `to_disk()` conversions
- Add `BaseDisk` domain type for immutable COW fork points (snapshots,
  clone bases, rootfs cache) with `BaseDiskManager` for lifecycle ops
- Add `SnapshotManager` to orchestrate snapshot create/restore/remove
  using the new `BaseDisk` layer
- Bump DB schema to v7: add `base_disk`, `base_disk_ref`, `snapshot`
  tables; migrate from `box_snapshot`; add v6→v7 migration
- Add `clone_boxes` batch clone support to `BoxBackend` trait and
  REST proxy implementation
- Refactor `guest_rootfs_manager` to use `BaseDisk` for rootfs caching
- Update Node.js/Python SDK bindings for flattened `DiskInfo` fields
The v6→v7 migration was deleting rootfs-base without updating
guest-rootfs.qcow2's backing file reference, breaking legacy boxes.

Changes:
- Rewrite migrate_rootfs_base to move rootfs-base into bases/ and
  rebase the qcow2 backing file path via set_backing_file_path()
- Add set_backing_file_path() to qcow2 module for updating backing
  references in qcow2 headers
- Add runtime backing chain validation in guest_rootfs.rs to catch
  broken chains early on restart with a clear error message

Verified end-to-end: PyPI 0.6.0 (schema v6) → dev (schema v7)
migration preserves boxes, snapshots, and disk data.
@DorianZheng DorianZheng merged commit 5ee9642 into main Mar 4, 2026
4 checks passed
@DorianZheng DorianZheng deleted the refactor/disk-info-base-disk-v7-schema branch March 4, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant