From 34b03fe2b3bed3e945c3818dd3b15dbc47c7912a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 9 Nov 2013 16:46:06 +0100 Subject: [PATCH] backup: fix setting backup qubes.xml attributes Cannot compare QubesVm objects, because we have different instances of QubesVmCollection. So compare QID instead. --- core/qubesutils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/qubesutils.py b/core/qubesutils.py index 66ccb789..3c7ddf8d 100644 --- a/core/qubesutils.py +++ b/core/qubesutils.py @@ -789,12 +789,11 @@ def backup_prepare(base_backup_dir, vms_list = None, exclude_list = [], print_ca if exclude_list is None: exclude_list = [] - qvm_collection = None - if vms_list is None: - qvm_collection = QubesVmCollection() - qvm_collection.lock_db_for_writing() - qvm_collection.load() + qvm_collection = QubesVmCollection() + qvm_collection.lock_db_for_writing() + qvm_collection.load() + if vms_list is None: all_vms = [vm for vm in qvm_collection.values()] selected_vms = [vm for vm in all_vms if vm.include_in_backups] appvms_to_backup = [vm for vm in selected_vms if vm.is_appvm() and not vm.internal] @@ -910,10 +909,11 @@ def backup_prepare(base_backup_dir, vms_list = None, exclude_list = [], print_ca print_callback(s) # Initialize backup flag on all VMs + vms_for_backup_qid = [vm.qid for vm in vms_for_backup] for vm in qvm_collection.values(): vm.backup_content = False - if vm in vms_for_backup: + if vm.qid in vms_for_backup_qid: vm.backup_content = True vm.backup_size = vm.get_disk_utilization() vm.backup_path = vm.dir_path.split(os.path.normpath(system_path["qubes_base_dir"])+"/")[1]