From 27b5aac7ad4900ea9c89d3e0e2aae1051cb92303 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 20 Apr 2012 02:52:05 +0200 Subject: [PATCH] dom0/backup-restore: restore all attributes --- dom0/qvm-core/qubesutils.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dom0/qvm-core/qubesutils.py b/dom0/qvm-core/qubesutils.py index 9cfe57b5..c2c29a34 100644 --- a/dom0/qvm-core/qubesutils.py +++ b/dom0/qvm-core/qubesutils.py @@ -834,6 +834,12 @@ def backup_restore_prepare(backup_dir, options = {}, host_collection = None): else: netvm_name = vm.netvm.name vms_to_restore[vm.name]['netvm'] = netvm_name + # Set to None to not confuse QubesVm object from backup + # collection with host collection (further in clone_attrs). Set + # directly _netvm to suppress setter action, especially + # modifying firewall + vm._netvm = None + netvm_on_host = host_collection.get_vm_by_name (netvm_name) # No netvm on the host? @@ -1036,6 +1042,12 @@ def backup_restore_do(backup_dir, restore_info, host_collection = None, print_ca host_collection.pop(new_vm.qid) continue + try: + new_vm.clone_attrs(vm) + except Exception as err: + error_callback("ERROR: {0}".format(err)) + error_callback("*** Some VM property will not be restored") + try: new_vm.create_appmenus(verbose=True) except Exception as err: @@ -1095,6 +1107,12 @@ def backup_restore_do(backup_dir, restore_info, host_collection = None, print_ca new_vm.uses_default_netvm = False new_vm.netvm = netvm + try: + new_vm.clone_attrs(vm) + except Exception as err: + error_callback("ERROR: {0}".format(err)) + error_callback("*** Some VM property will not be restored") + try: new_vm.verify_files() except Exception as err: @@ -1153,6 +1171,12 @@ def backup_restore_do(backup_dir, restore_info, host_collection = None, print_ca new_vm.uses_default_netvm = False new_vm.netvm = netvm + try: + new_vm.clone_attrs(vm) + except Exception as err: + error_callback("ERROR: {0}".format(err)) + error_callback("*** Some VM property will not be restored") + try: new_vm.create_appmenus(verbose=True) except Exception as err: