Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qubes/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,12 @@ async def backup_do(self):
backup_app.domains[qid].features["backup-content"] = True
backup_app.domains[qid].features["backup-path"] = vm_info.subdir
backup_app.domains[qid].features["backup-size"] = vm_info.size
for feature in backup_app.domains[qid].features.copy():
if (
feature.startswith("preload-dispvm")
and feature != "preload-dispvm-max"
):
del backup_app.domains[qid].features[feature]

# VM running private volumes without snapshoting them
# (revision_to_keep = -1) must be powered off to be backup
Expand Down
34 changes: 33 additions & 1 deletion qubes/tests/integ/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ def create_backup_vms(self, pool=None):
self.loop.run_until_complete(testvm4.create_on_disk(pool=pool))
vms.append(testvm4)

vmname = self.make_vm_name("dvm")
self.log.debug("Creating %s" % vmname)
testvm5 = self.app.add_new_vm(
qubes.vm.appvm.AppVM,
name=vmname,
template=testvm3,
label="red",
template_for_dispvms=True,
)
self.loop.run_until_complete(testvm5.create_on_disk(pool=pool))
testvm5.features["qrexec"] = True
testvm5.features["supported-rpc.qubes.WaitForRunningSystem"] = True
testvm5.features["preload-dispvm-max"] = 0
testvm5.features["preload-dispvm"] = ""
vms.append(testvm5)

self.app.save()

return vms
Expand Down Expand Up @@ -318,6 +334,7 @@ def get_vms_info(self, vms):
vm_info = {
"properties": {},
"default": {},
"features": {},
"devices": {},
}
for prop in (
Expand All @@ -328,7 +345,7 @@ def get_vms_info(self, vms):
"kernelopts",
"services",
"vcpus",
"features" "include_in_backups",
"include_in_backups",
"default_user",
"qrexec_timeout",
"autostart",
Expand All @@ -343,6 +360,7 @@ def get_vms_info(self, vms):
continue
vm_info["properties"][prop] = str(getattr(vm, prop))
vm_info["default"][prop] = vm.property_is_default(prop)
vm_info["features"].update(vm.features)
for dev_class in vm.devices.keys():
vm_info["devices"][dev_class] = {}
for ass in vm.devices[dev_class].get_assigned_devices():
Expand Down Expand Up @@ -379,6 +397,20 @@ def assertCorrectlyRestored(self, vms_info, orig_hashes):
vm_name, prop
),
)
for feature in vm_info["features"]:
if (
feature.startswith("preload-dispvm")
and feature != "preload-dispvm-max"
):
self.assertIsNone(restored_vm.features.get(feature, None))
continue
self.assertEqual(
vm_info["features"][feature],
restored_vm.features.get(feature),
"VM {} - feature {} not properly restored".format(
vm_name, feature
),
)
for dev_class in vm_info["devices"]:
for dev in vm_info["devices"][dev_class]:
found = False
Expand Down