Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce "create_grace_time" option #26

Merged
merged 2 commits into from
Oct 6, 2022
Merged

Introduce "create_grace_time" option #26

merged 2 commits into from
Oct 6, 2022

Conversation

edigaryev
Copy link
Contributor

Problem: when invoking "tart run" straight after "tart create", the former may display a black screen. The culprit seems to be the Virtualization.Framework, which still doesn't close the VM's files for some time after the Tart terminates:

% tart create --from-ipsw=latest vm ; lsof ~/.tart/vms/vm/disk.img ~/.tart/vms/vm/nvram.bin
Using cached *.ipsw file...
Installing OS...
100%
COMMAND    PID USER   FD   TYPE DEVICE    SIZE/OFF     NODE NAME
com.apple 9830  edi    3u   REG   1,16    33570816 11748431 /Users/edi/.tart/vms/vm/nvram.bin
com.apple 9830  edi    4u   REG   1,16 50000000000 11748432 /Users/edi/.tart/vms/vm/disk.img

Solution: introduce an option that if specified, will force the Packer plugin to wait for the specified time after "tart create" finishes.

@@ -34,6 +35,13 @@ func (s *stepCreateVM) Run(ctx context.Context, state multistep.StateBag) multis
return multistep.ActionHalt
}

if config.CreateGraceTime != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we always wait if that seems the case? Why we need to configure it? Or maybe set some default timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there's a golden value that we can hardcode for this racy situation. Some people might want it as short as possible, some might want it to be rather large to be on the safe side.

I'd suggest we leave as for now and see how well it works out in https://github.com/cirruslabs/macos-image-templates.

@edigaryev edigaryev requested a review from fkorotkov October 6, 2022 13:30
@edigaryev edigaryev merged commit d018787 into main Oct 6, 2022
@edigaryev edigaryev deleted the create-grace-time branch October 6, 2022 13:41
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.

2 participants