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

feat: Saving and restoring VMs #1261

Open
alexpaniman opened this issue May 30, 2024 · 1 comment
Open

feat: Saving and restoring VMs #1261

alexpaniman opened this issue May 30, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@alexpaniman
Copy link

alexpaniman commented May 30, 2024

I'm trying to save state of a MacOS Sonoma VM like so:

  1. I launch a VM
quickemu --vm macos-sonoma.conf
  1. And then connect to qemu monitor socket and use savevm:
nc -U "macos-sonoma/macos-sonoma-monitor.socket"
(qemu) savevm empty

Which gives me:

Error: Device 'pflash1' is writable but does not support snapshots

As I understand, this is caused by unit=1 drive for EFI_VARS, which uses pflash that doesn't support snapshots, relevant piece of code from generated by quickemu macos-sonoma/macos-sonoma.sh:

-drive if=pflash,format=raw,unit=0,file=macos-sonoma/OVMF_CODE.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=macos-sonoma/OVMF_VARS-1920x1080.fd \

As far as I know, this can be solved by either (1) making OVMF_VARS-1920x1080.fd read only or (2) switching image type to .cow2 (which I'm not sure is possible, I mean, why does it use pflash to begin with?)

I tried option (1) — the issue goes away when I add readonly=on, I can save and restore VM after that without any problem:

-drive if=pflash,format=raw,unit=1,file=macos-sonoma/OVMF_VARS-1920x1080.fd,readonly=on

It's probably not a great default option, since it makes changing EFI vars from within a VM impossible, but can there be made a switch to make it read only when I've already set up EFI vars the way I want, let's say an option in config, like mount_efi_vars_readonly or something?

If so, it seems like a very simple patch, I'd be happy to write a PR.

@lj3954 lj3954 added enhancement New feature or request help wanted Extra attention is needed labels Jun 5, 2024
@lj3954
Copy link
Contributor

lj3954 commented Jun 8, 2024

#1269 - Windows VMs additionally cannot be saved due to the CPU flag.

@flexiondotorg flexiondotorg changed the title Saving and restoring VMs feat: Saving and restoring VMs Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants