backup/restore: improve error message about restoring tags
Before reporting a tag as not restored, verify if it really wasn't restored. Generally created-by-* tags cannot be created manually. But when restoring a backup in dom0, created-by-dom0 tag is added, which in many cases will match what want to be restored. Adjust tests to check this too.
This commit is contained in:
parent
2b6b4e7954
commit
114f6fb250
@ -2035,6 +2035,7 @@ class BackupRestore(object):
|
|||||||
try:
|
try:
|
||||||
new_vm.tags.add(tag)
|
new_vm.tags.add(tag)
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err: # pylint: disable=broad-except
|
||||||
|
if tag not in new_vm.tags:
|
||||||
self.log.error('Error adding tag %s to %s: %s',
|
self.log.error('Error adding tag %s to %s: %s',
|
||||||
tag, vm.name, err)
|
tag, vm.name, err)
|
||||||
|
|
||||||
|
@ -1440,6 +1440,12 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
str(value).encode())] = b'0\0'
|
str(value).encode())] = b'0\0'
|
||||||
|
|
||||||
for tag in vm['tags']:
|
for tag in vm['tags']:
|
||||||
|
if tag.startswith('created-by-'):
|
||||||
|
self.app.expected_calls[
|
||||||
|
(name, 'admin.vm.tag.Set', tag, None)] = b''
|
||||||
|
self.app.expected_calls[
|
||||||
|
(name, 'admin.vm.tag.Get', tag, None)] = b'0\0001'
|
||||||
|
else:
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
(name, 'admin.vm.tag.Set', tag, None)] = b'0\0'
|
(name, 'admin.vm.tag.Set', tag, None)] = b'0\0'
|
||||||
|
|
||||||
@ -1727,6 +1733,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
# retrieve calls from other multiprocess.Process instances
|
# retrieve calls from other multiprocess.Process instances
|
||||||
while not qubesd_calls_queue.empty():
|
while not qubesd_calls_queue.empty():
|
||||||
call_args = qubesd_calls_queue.get()
|
call_args = qubesd_calls_queue.get()
|
||||||
|
with contextlib.suppress(qubesadmin.exc.QubesException):
|
||||||
self.app.qubesd_call(*call_args)
|
self.app.qubesd_call(*call_args)
|
||||||
qubesd_calls_queue.close()
|
qubesd_calls_queue.close()
|
||||||
|
|
||||||
@ -1797,6 +1804,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
# retrieve calls from other multiprocess.Process instances
|
# retrieve calls from other multiprocess.Process instances
|
||||||
while not qubesd_calls_queue.empty():
|
while not qubesd_calls_queue.empty():
|
||||||
call_args = qubesd_calls_queue.get()
|
call_args = qubesd_calls_queue.get()
|
||||||
|
with contextlib.suppress(qubesadmin.exc.QubesException):
|
||||||
self.app.qubesd_call(*call_args)
|
self.app.qubesd_call(*call_args)
|
||||||
qubesd_calls_queue.close()
|
qubesd_calls_queue.close()
|
||||||
|
|
||||||
@ -1867,6 +1875,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
# retrieve calls from other multiprocess.Process instances
|
# retrieve calls from other multiprocess.Process instances
|
||||||
while not qubesd_calls_queue.empty():
|
while not qubesd_calls_queue.empty():
|
||||||
call_args = qubesd_calls_queue.get()
|
call_args = qubesd_calls_queue.get()
|
||||||
|
with contextlib.suppress(qubesadmin.exc.QubesException):
|
||||||
self.app.qubesd_call(*call_args)
|
self.app.qubesd_call(*call_args)
|
||||||
qubesd_calls_queue.close()
|
qubesd_calls_queue.close()
|
||||||
|
|
||||||
@ -1968,6 +1977,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
# retrieve calls from other multiprocess.Process instances
|
# retrieve calls from other multiprocess.Process instances
|
||||||
while not qubesd_calls_queue.empty():
|
while not qubesd_calls_queue.empty():
|
||||||
call_args = qubesd_calls_queue.get()
|
call_args = qubesd_calls_queue.get()
|
||||||
|
with contextlib.suppress(qubesadmin.exc.QubesException):
|
||||||
self.app.qubesd_call(*call_args)
|
self.app.qubesd_call(*call_args)
|
||||||
qubesd_calls_queue.close()
|
qubesd_calls_queue.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user