Hi Stefan,
I am investigating QEMU devices with persistent state like swtpm for a
specific snapshot use case. The VM is paused while disk images and other
persistent state files are snapshotted. This creates a crash-consistent
snapshot similar to booting after power failure on a real machine. No
RAM or volatile device state is collected.

My concern is how to ensure the swtpm's persistent state is captured as
consistently as possible, but I'm not very familiar with the code. I
wanted to run the following by you:

- Using --tpmstate dir= will write the persistent state to a new
  temporary file and then atomically replace the old .permall file using
  rename(2).

- If the VM is paused and a copy of the .permall file is taken, then
  this copy is consistent. It may not reflect any in-progress changes
  being written into a new temporary file, but that doesn't matter from
  the snapshot point of view since the VM is paused and it hasn't seen
  the completion of in-progress TPM operations.

- The .volatilestate and .savestate files do not need to be captured in
  the snapshot since the goal is just to achieve crash consistency.

Does this sound reasonable or have I missed something?

Thanks,
Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to