From 74f8d4531ec5fa4ea592e9a0bd27c5226d36a5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sat, 20 Jul 2019 15:27:09 +0200 Subject: [PATCH 1/2] Prevent 'qubesd' for crashing if any device backend is not available --- qubes/vm/__init__.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/qubes/vm/__init__.py b/qubes/vm/__init__.py index 0b4ac6f8..4dadc3de 100644 --- a/qubes/vm/__init__.py +++ b/qubes/vm/__init__.py @@ -268,13 +268,19 @@ class BaseVM(qubes.PropertyHolder): for option in node.xpath('./option'): options[option.get('name')] = option.text - device_assignment = qubes.devices.DeviceAssignment( - self.app.domains[node.get('backend-domain')], - node.get('id'), - options, - persistent=True - ) - self.devices[devclass].load_persistent(device_assignment) + try: + device_assignment = qubes.devices.DeviceAssignment( + self.app.domains[node.get('backend-domain')], + node.get('id'), + options, + persistent=True + ) + self.devices[devclass].load_persistent(device_assignment) + except KeyError: + msg = "{}: Cannot find backend domain '{}' for device type {} '{}'".format(self.name, node.get( + 'backend-domain'), devclass, node.get('id')) + self.log.info(msg) + continue # tags for node in self.xml.xpath('./tags/tag'): From 6c8bdfaa4bd2bacea501a59c59546e3cd6a40148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 31 Jul 2019 15:36:03 +0200 Subject: [PATCH 2/2] Fix too long line --- qubes/vm/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qubes/vm/__init__.py b/qubes/vm/__init__.py index 4dadc3de..7864719d 100644 --- a/qubes/vm/__init__.py +++ b/qubes/vm/__init__.py @@ -277,8 +277,9 @@ class BaseVM(qubes.PropertyHolder): ) self.devices[devclass].load_persistent(device_assignment) except KeyError: - msg = "{}: Cannot find backend domain '{}' for device type {} '{}'".format(self.name, node.get( - 'backend-domain'), devclass, node.get('id')) + msg = "{}: Cannot find backend domain '{}' " \ + "for device type {} '{}'".format(self.name, node.get( + 'backend-domain'), devclass, node.get('id')) self.log.info(msg) continue