1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

feat(vmbackups): back up a shut-off VM's TPM state

A VM with the panel's emulated TPM 2.0 is backed up when it is shut off:
each state file of libvirt's swtpm directory for the VM, read through a
transient pool on it, becomes a small file of the backup (role tpm),
written and read back like the NVRAM file. A running or paused VM with a
TPM is refused, and so is a TPM with its own settings (encryption, a
state path, another backend). The manifest says whether the TPM state was
copied or never written.
This commit is contained in:
catborise 2026-11-17 13:47:40 +03:00
parent a145c07601
commit 52b6096efe
11 changed files with 371 additions and 166 deletions

View file

@ -115,12 +115,12 @@ class Backup(models.Model):
class BackupFile(models.Model):
DISK, NVRAM, DOMAIN, MANIFEST = "disk", "nvram", "domain", "manifest"
ROLES = [(DISK, "disk"), (NVRAM, "nvram"), (DOMAIN, "domain"), (MANIFEST, "manifest")]
DISK, NVRAM, TPM, DOMAIN, MANIFEST = "disk", "nvram", "tpm", "domain", "manifest"
ROLES = [(DISK, "disk"), (NVRAM, "nvram"), (TPM, "tpm"), (DOMAIN, "domain"), (MANIFEST, "manifest")]
backup = models.ForeignKey(Backup, on_delete=models.CASCADE, related_name="files")
role = models.CharField(max_length=16, choices=ROLES)
dev = models.CharField(max_length=32, blank=True)
dev = models.CharField(max_length=32, blank=True) # a disk's target, a TPM state file's name
volume = models.CharField(max_length=255)
format = models.CharField(max_length=16, blank=True)
capacity = models.BigIntegerField(default=0)