Skip to content
New issue

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

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

Already on GitHub? # to your account

Does lima support checkpoint backup and restore like normal virtual machine? #1051

Closed
jandubois opened this issue Sep 13, 2022 Discussed in #1050 · 6 comments · Fixed by #1054
Closed

Does lima support checkpoint backup and restore like normal virtual machine? #1051

jandubois opened this issue Sep 13, 2022 Discussed in #1050 · 6 comments · Fixed by #1054
Labels
enhancement New feature or request

Comments

@jandubois
Copy link
Member

Discussed in #1050

Originally posted by f91og September 13, 2022
Just want to quick restore to a certain status after tried several things that caused develop environment broken

@jandubois jandubois added the enhancement New feature or request label Sep 13, 2022
@jandubois
Copy link
Member Author

jandubois commented Sep 13, 2022

It should be possible to create something with the qemu savevm and loadvm commands:

Does qemu emulator have checkpoint function? - Stack Overflow]

@afbjorklund
Copy link
Member

afbjorklund commented Sep 13, 2022

Apparently these are missing from (older versions of ?) QMP, so might need be issued differently (monitor?).

https://github.com/digitalocean/go-qemu

https://lore.kernel.org/all/20200702175754.2211821-3-berrange@redhat.com/

savevm, loadvm and delvm are some of the few commands that have never
been converted to use QMP. The primary reason for this lack of
conversion is that they block execution of the thread for as long as
they run.

It also hints at the workaround: (HumanMonitorCommand)

Despite this downside, however, libvirt and applications using libvirt
has used these commands for as long as QMP has existed, via the
"human-monitor-command" passthrough command. IOW, while it is clearly
desirable to be able to fix the blocking problem, this is not an
immediate obstacle to real world usage.

@afbjorklund

This comment was marked as outdated.

@afbjorklund
Copy link
Member

afbjorklund commented Sep 14, 2022

Beyond backup (savevm) and restore (loadvm), might want to add a third command for removing a snapshot (delvm) ?

As a workaround, it is also possible to do it with qemu-img snapshot -d my-tag ~/.lima/default/diffdisk outside of lima

@afbjorklund
Copy link
Member

afbjorklund commented Sep 15, 2022

Newer versions of qemu-img default to read-only images, which means that the command will work on running instances...

For older versions, it is possible to use the --force-share flag with the snapshot -l command (it should still be safe)

@afbjorklund
Copy link
Member

Now a single command, with sub-commands:

Usage:
  limactl snapshot [command]

Available Commands:
  apply       Apply (load) a snapshot
  create      Create (save) a snapshot
  delete      Delete (del) a snapshot
  list        List existing snapshots

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants