Issue #3303
This commit is contained in:
parent
91759077ff
commit
6fe5f8c0e7
@ -70,6 +70,7 @@ _re_alphanum = re.compile(r'^[A-Za-z0-9-]*$')
|
|||||||
_tar_msg_re = re.compile(r".*#[0-9].*restore_pipe")
|
_tar_msg_re = re.compile(r".*#[0-9].*restore_pipe")
|
||||||
_tar_file_size_re = re.compile(r"^[^ ]+ [^ ]+/[^ ]+ *([0-9]+) .*")
|
_tar_file_size_re = re.compile(r"^[^ ]+ [^ ]+/[^ ]+ *([0-9]+) .*")
|
||||||
|
|
||||||
|
|
||||||
class BackupCanceledError(QubesException):
|
class BackupCanceledError(QubesException):
|
||||||
'''Exception raised when backup/restore was cancelled'''
|
'''Exception raised when backup/restore was cancelled'''
|
||||||
def __init__(self, msg, tmpdir=None):
|
def __init__(self, msg, tmpdir=None):
|
||||||
@ -1356,7 +1357,9 @@ 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)
|
||||||
to_extract.put(os.path.join(self.tmpdir, filename))
|
|
||||||
|
if not self.options.verify_only:
|
||||||
|
to_extract.put(os.path.join(self.tmpdir, filename))
|
||||||
|
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
raise BackupCanceledError("Restore canceled",
|
raise BackupCanceledError("Restore canceled",
|
||||||
@ -1749,6 +1752,9 @@ class BackupRestore(object):
|
|||||||
if vm and vm_info.subdir:
|
if vm and vm_info.subdir:
|
||||||
vms_size += int(vm_info.size)
|
vms_size += int(vm_info.size)
|
||||||
vms_dirs.append(vm_info.subdir)
|
vms_dirs.append(vm_info.subdir)
|
||||||
|
|
||||||
|
if self.options.verify_only:
|
||||||
|
continue
|
||||||
for name, volume in vm.volumes.items():
|
for name, volume in vm.volumes.items():
|
||||||
if not volume.save_on_stop:
|
if not volume.save_on_stop:
|
||||||
continue
|
continue
|
||||||
@ -1824,21 +1830,24 @@ class BackupRestore(object):
|
|||||||
new_vm = None
|
new_vm = None
|
||||||
vm_name = restore_info[vm.name].name
|
vm_name = restore_info[vm.name].name
|
||||||
|
|
||||||
try:
|
if self.options.verify_only:
|
||||||
# first only create VMs, later setting may require other VMs
|
new_vm = self.backup_app.domains[vm_name]
|
||||||
# be already created
|
else:
|
||||||
new_vm = self.app.add_new_vm(
|
try:
|
||||||
vm.klass,
|
# first only create VMs, later setting may require other VMs
|
||||||
name=vm_name,
|
# be already created
|
||||||
label=vm.label,
|
new_vm = self.app.add_new_vm(
|
||||||
pool=self.options.override_pool,
|
vm.klass,
|
||||||
**kwargs)
|
name=vm_name,
|
||||||
except Exception as err: # pylint: disable=broad-except
|
label=vm.label,
|
||||||
self.log.error('Error restoring VM %s, skipping: %s',
|
pool=self.options.override_pool,
|
||||||
vm.name, err)
|
**kwargs)
|
||||||
if new_vm:
|
except Exception as err: # pylint: disable=broad-except
|
||||||
del self.app.domains[new_vm.name]
|
self.log.error('Error restoring VM %s, skipping: %s',
|
||||||
continue
|
vm.name, err)
|
||||||
|
if new_vm:
|
||||||
|
del self.app.domains[new_vm.name]
|
||||||
|
continue
|
||||||
|
|
||||||
restore_info[vm.name].restored_vm = new_vm
|
restore_info[vm.name].restored_vm = new_vm
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user