Fix dom0-related issues
This commit is contained in:
parent
d84423b0b2
commit
c6bc4f05cb
@ -1357,6 +1357,7 @@ class BackupRestore(object):
|
|||||||
# This all means that if the file was correctly verified
|
# This all means that if the file was correctly verified
|
||||||
# + decrypted, we will surely access the right file
|
# + decrypted, we will surely access the right file
|
||||||
filename = self._verify_and_decrypt(filename)
|
filename = self._verify_and_decrypt(filename)
|
||||||
|
|
||||||
if not self.options.verify_only:
|
if not self.options.verify_only:
|
||||||
to_extract.put(os.path.join(self.tmpdir, filename))
|
to_extract.put(os.path.join(self.tmpdir, filename))
|
||||||
else:
|
else:
|
||||||
@ -1537,7 +1538,8 @@ class BackupRestore(object):
|
|||||||
if self.options.dom0_home and \
|
if self.options.dom0_home and \
|
||||||
self.backup_app.domains['dom0'].included_in_backup:
|
self.backup_app.domains['dom0'].included_in_backup:
|
||||||
vm = self.backup_app.domains['dom0']
|
vm = self.backup_app.domains['dom0']
|
||||||
vms_to_restore['dom0'] = self.Dom0ToRestore(vm)
|
vms_to_restore['dom0'] = self.Dom0ToRestore(vm,
|
||||||
|
self.backup_app.domains['dom0'].backup_path)
|
||||||
local_user = grp.getgrnam('qubes').gr_mem[0]
|
local_user = grp.getgrnam('qubes').gr_mem[0]
|
||||||
|
|
||||||
if vms_to_restore['dom0'].username != local_user:
|
if vms_to_restore['dom0'].username != local_user:
|
||||||
@ -1627,6 +1629,10 @@ class BackupRestore(object):
|
|||||||
vm_info.problems:
|
vm_info.problems:
|
||||||
summary_line += " <-- No matching netvm on the host " \
|
summary_line += " <-- No matching netvm on the host " \
|
||||||
"or in the backup found!"
|
"or in the backup found!"
|
||||||
|
elif vm_info.name == "dom0" and \
|
||||||
|
BackupRestore.Dom0ToRestore.USERNAME_MISMATCH in \
|
||||||
|
restore_info['dom0'].problems:
|
||||||
|
summary_line += " <-- username in backup and dom0 mismatch"
|
||||||
else:
|
else:
|
||||||
if vm_info.template != vm_info.vm.template:
|
if vm_info.template != vm_info.vm.template:
|
||||||
summary_line += " <-- Template change to '{}'".format(
|
summary_line += " <-- Template change to '{}'".format(
|
||||||
@ -1637,23 +1643,6 @@ class BackupRestore(object):
|
|||||||
|
|
||||||
summary += summary_line + "\n"
|
summary += summary_line + "\n"
|
||||||
|
|
||||||
if 'dom0' in restore_info.keys():
|
|
||||||
summary_line = ""
|
|
||||||
for field in fields_to_display:
|
|
||||||
# noinspection PyTypeChecker
|
|
||||||
fmt = "{{0:>{0}}} |".format(fields[field]["max_width"] + 1)
|
|
||||||
if field == "name":
|
|
||||||
summary_line += fmt.format("Dom0")
|
|
||||||
elif field == "type":
|
|
||||||
summary_line += fmt.format("Home")
|
|
||||||
else:
|
|
||||||
summary_line += fmt.format("")
|
|
||||||
if BackupRestore.Dom0ToRestore.USERNAME_MISMATCH in \
|
|
||||||
restore_info['dom0'].problems:
|
|
||||||
summary_line += " <-- username in backup and dom0 mismatch"
|
|
||||||
|
|
||||||
summary += summary_line + "\n"
|
|
||||||
|
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -1751,6 +1740,13 @@ class BackupRestore(object):
|
|||||||
for vm_info in self._templates_first(restore_info.values()):
|
for vm_info in self._templates_first(restore_info.values()):
|
||||||
vm = vm_info.restored_vm
|
vm = vm_info.restored_vm
|
||||||
if vm and vm_info.subdir:
|
if vm and vm_info.subdir:
|
||||||
|
if isinstance(vm_info, self.Dom0ToRestore) and \
|
||||||
|
vm_info.good_to_go:
|
||||||
|
vms_dirs.append(os.path.dirname(restore_info['dom0'].subdir))
|
||||||
|
vms_size += int(restore_info['dom0'].size)
|
||||||
|
if not self.options.verify_only:
|
||||||
|
handlers[restore_info['dom0'].subdir] = (self._handle_dom0, None)
|
||||||
|
else:
|
||||||
vms_size += int(vm_info.size)
|
vms_size += int(vm_info.size)
|
||||||
vms_dirs.append(vm_info.subdir)
|
vms_dirs.append(vm_info.subdir)
|
||||||
|
|
||||||
@ -1771,12 +1767,6 @@ class BackupRestore(object):
|
|||||||
'whitelisted-appmenus.list')] = (
|
'whitelisted-appmenus.list')] = (
|
||||||
functools.partial(self._handle_appmenus_list, vm), None)
|
functools.partial(self._handle_appmenus_list, vm), None)
|
||||||
|
|
||||||
if 'dom0' in restore_info.keys() and \
|
|
||||||
restore_info['dom0'].good_to_go:
|
|
||||||
vms_dirs.append(os.path.dirname(restore_info['dom0'].subdir))
|
|
||||||
vms_size += restore_info['dom0'].size
|
|
||||||
if not self.options.verify_only:
|
|
||||||
handlers[restore_info['dom0'].subdir] = (self._handle_dom0, None)
|
|
||||||
try:
|
try:
|
||||||
self._restore_vm_data(vms_dirs=vms_dirs, vms_size=vms_size,
|
self._restore_vm_data(vms_dirs=vms_dirs, vms_size=vms_size,
|
||||||
handlers=handlers)
|
handlers=handlers)
|
||||||
|
@ -176,7 +176,8 @@ def handle_broken(app, args, restore_info):
|
|||||||
raise qubesadmin.exc.QubesException(
|
raise qubesadmin.exc.QubesException(
|
||||||
"INTERNAL ERROR! Please report this to the Qubes OS team!")
|
"INTERNAL ERROR! Please report this to the Qubes OS team!")
|
||||||
|
|
||||||
if 'dom0' in restore_info.keys() and args.dom0_home:
|
if 'dom0' in restore_info.keys() and args.dom0_home \
|
||||||
|
and not args.verify_only:
|
||||||
if dom0_username_mismatch:
|
if dom0_username_mismatch:
|
||||||
app.log.warning("*** Dom0 username mismatch! This can break "
|
app.log.warning("*** Dom0 username mismatch! This can break "
|
||||||
"some settings! ***")
|
"some settings! ***")
|
||||||
|
Loading…
Reference in New Issue
Block a user