backup.py: add vmN/empty file if no other files to backup

This commit is contained in:
Rusty Bird 2018-02-24 22:43:53 +00:00
parent 59abdeb30e
commit 6886e70aa9
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,4 @@
d /var/run/qubes 2770 root qubes
f /var/run/qubes/xl-lock 0660 root qubes
f /var/run/qubes/empty 0444 root qubes
d /var/run/xen-hotplug 0755 root root

View File

@ -381,6 +381,15 @@ class Backup(object):
if os.path.exists(firewall_conf):
vm_files.append(self.FileToBackup(firewall_conf, subdir))
if not vm_files:
# subdir/ is needed in the tar file, otherwise restore
# of a (Disp)VM without any backed up files is going
# to fail. Adding a zero-sized file here happens to be
# more straightforward than adding an empty directory.
empty = self.FileToBackup("/var/run/qubes/empty", subdir)
assert empty.size == 0
vm_files.append(empty)
files_to_backup[vm.qid] = self.VMToBackup(vm, vm_files, subdir)
# Dom0 user home