这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@fkorotkov
Copy link
Contributor

@fkorotkov fkorotkov commented Jun 14, 2025

Used http://augmentcode.com/ to generate the following in 3 prompts. See each commit.

This adds support ASIF (Apple Sparse Image Format) provides better performance on macOS 26 Tahoe and later systems while maintaining compatibility with existing RAW disk workflows.

In addition each VM config now has a metadata about the format and tart set --disk-size N will use diskutils to resize which is reflected in the VM (no need to SSH and run the extra step inside of the guest).

@CLAassistant
Copy link

CLAassistant commented Jun 14, 2025

CLA assistant check
All committers have signed the CLA.

@fkorotkov fkorotkov force-pushed the feature/disk-format-selection branch from 8453203 to b7f0c5e Compare June 14, 2025 17:41
- Use .uncached caching mode for ASIF disks to avoid Virtualization framework compatibility issues
- Improve caching mode selection logic for better maintainability
- Fix compiler warning by changing var to let for attachment variable

This resolves VM startup failures when using ASIF disk format by ensuring proper disk attachment configuration.
Change from 'brew install --cask goreleaser-pro' to 'brew install --cask goreleaser/tap/goreleaser-pro' for proper installation from the official goreleaser tap.
- Remove .vscode/launch.json from repository
- Add .vscode/ to .gitignore to prevent VS Code settings from being tracked
@fkorotkov fkorotkov marked this pull request as ready for review June 15, 2025 01:58
@fkorotkov fkorotkov requested a review from edigaryev as a code owner June 15, 2025 01:58
- Add support for resizing ASIF disk images using diskutil image resize
- Detect disk format from VM config and route to appropriate resize method
- Use diskutil image info to get current ASIF disk size and validate resize
- Remove restriction that prevented ASIF disk resizing in Set command
- Add FailedToResizeDisk error case for proper error handling
- Maintain backward compatibility with raw disk resizing
- Add comprehensive size validation to prevent data loss
fkorotkov added a commit to cirruslabs/packer-plugin-tart that referenced this pull request Jun 15, 2025
Add support for --disk-format argument to specify disk image format
when creating VMs with from_ipsw or from_iso.

Changes:
- Add DiskFormat field to Config struct with validation
- Support 'raw' (default) and 'asif' disk formats
- Pass --disk-format argument to tart create command
- Update HCL2 specification for new field
- Add comprehensive documentation
- Include example configuration demonstrating usage

ASIF (Apple Sparse Image Format) provides better performance but
requires macOS 15+ for usage and macOS 26+ for creation.

Implements support for cirruslabs/tart#1094
try diskFileHandle.close()
}

private func resizeASIFDisk(_ sizeGB: UInt16) throws {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be logical to move this function and functions below to DiskImageFormat instead now that we have it.

fkorotkov and others added 10 commits June 17, 2025 11:11
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
- Rename testFormatArgument to testCaseInsensitivity for clarity
- Remove redundant 'raw' and 'invalid' test cases already covered in testFormatFromString
- Remove testFormatDescriptions test as it's not very useful

Addresses review comment: #1094 (comment)
- Remove canCreate property since it's the same as isSupported
- Remove description property entirely as it's not used
- Fix displayName for RAW format (remove UDIF reference)
- Remove checkDiskutilASIFSupport helper function

Addresses review comments:
- #1094 (comment)
- #1094 (comment)
- #1094 (comment)
- Simplify ArgumentParser help text to let it show possible values automatically
- Remove canCreate validation since property was removed
- Simplify error message for unsupported disk formats

Addresses review comment: #1094 (comment)
- Add validation to ensure ASIF disk format is supported on current system
- Check disk format compatibility before attempting to run VM

Addresses review comment: #1094 (comment)
- Add diskFormatLabelAnnotation constant in Manifest.swift
- Use org.cirruslabs.tart.disk.format namespace for consistency
- Use variable shadowing instead of new variable name for labels

Addresses review comment: #1094 (comment)
- Remove .uncached caching mode for ASIF disks
- Use default caching logic for all disk formats
- Testing shows .cached mode works fine on macOS 26.0

Addresses review comment: #1094 (comment)
- Use guard let instead of nested if let for better readability
- Reduce nesting in resizeASIFDisk function
- Improve error handling flow

Addresses review comment: #1094 (comment)
@edigaryev edigaryev self-requested a review June 19, 2025 13:05
@edigaryev
Copy link
Collaborator

@fkorotkov please take a look at the review comments once more.

Some of them were not addressed, for example, #1094 (comment).

@edigaryev edigaryev self-requested a review June 19, 2025 14:21
@edigaryev edigaryev merged commit 3a6c5fb into main Jun 19, 2025
7 checks passed
@edigaryev edigaryev deleted the feature/disk-format-selection branch June 19, 2025 14:27
fkorotkov added a commit to cirruslabs/packer-plugin-tart that referenced this pull request Sep 11, 2025
Add support for --disk-format argument to specify disk image format
when creating VMs with from_ipsw or from_iso.

Changes:
- Add DiskFormat field to Config struct with validation
- Support 'raw' (default) and 'asif' disk formats
- Pass --disk-format argument to tart create command
- Update HCL2 specification for new field
- Add comprehensive documentation
- Include example configuration demonstrating usage

ASIF (Apple Sparse Image Format) provides better performance but
requires macOS 15+ for usage and macOS 26+ for creation.

Implements support for cirruslabs/tart#1094
edigaryev added a commit to cirruslabs/packer-plugin-tart that referenced this pull request Sep 16, 2025
* feat: Add disk_format support for tart create command

Add support for --disk-format argument to specify disk image format
when creating VMs with from_ipsw or from_iso.

Changes:
- Add DiskFormat field to Config struct with validation
- Support 'raw' (default) and 'asif' disk formats
- Pass --disk-format argument to tart create command
- Update HCL2 specification for new field
- Add comprehensive documentation
- Include example configuration demonstrating usage

ASIF (Apple Sparse Image Format) provides better performance but
requires macOS 15+ for usage and macOS 26+ for creation.

Implements support for cirruslabs/tart#1094

* fix: Skip disk resizing for ASIF disks

ASIF disks should not be resized using file truncation or in-guest
partition resizing. Instead, they should be resized using diskutil
on the host (handled by tart set --disk-size command).

Changes:
- Skip growDisk() operation for ASIF disks in step_disk_file_prepare.go
- Skip in-guest partition resizing for ASIF disks in step_disk_resize.go
- Add informative messages explaining why resizing is skipped

This prevents errors when trying to resize ASIF disk images and
ensures proper disk management for the ASIF format.

* Update docs/builders/tart.mdx

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* resize a VM via `tart set`

* review comments

* Fix import errors (#203)

* ASIF support PR improvements (#204)

* $ make generate

* Don't forget to set statekey.DiskChanged

---------

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
Co-authored-by: Brian Michel <brian.michel@gmail.com>
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.

4 participants