From 6583721cc55ebda3506e0046c4c9f3ae4a8393aa Mon Sep 17 00:00:00 2001 From: David Lehman Date: Wed, 3 Jul 2019 16:04:29 -0400 Subject: [PATCH] General protection against tracebacks during populate. The goal here is to absolutely minimize tracebacks that occur when populating the devicetree. There are mechanisms in place that will limit the supported functionality for managing such devices, but there will be no tracebacks until/unless the user tries to manage them in ways that are precluded by the detection issues previously encountered. --- blivet/populator/populator.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py index ebe205e62..743b8d09d 100644 --- a/blivet/populator/populator.py +++ b/blivet/populator/populator.py @@ -37,6 +37,7 @@ from ..devices import MDRaidArrayDevice from ..devices import MultipathDevice from ..devices import NoDevice +from ..devices import StorageDevice from ..devicelibs import disk as disklib from ..devicelibs import lvm from .. import formats @@ -262,7 +263,19 @@ def handle_device(self, info, update_orig_fmt=False): helper_class = self._get_device_helper(info) if helper_class is not None: - device = helper_class(self, info).run() + try: + device = helper_class(self, info).run() + except DeviceTreeError as e: + log.error("error handling device %s: %s", name, str(e)) + device = self.get_device_by_name(name, incomplete=True, hidden=True) + if device is None: + try: + parents = self._add_slave_devices(info) + except DeviceTreeError: + parents = [] + + device = StorageDevice(name, parents=parents, uuid=udev.device_get_uuid(info), + exists=True) if not device: log.debug("no device obtained for %s", name) @@ -302,7 +315,10 @@ def handle_format(self, info, device): helper_class = self._get_format_helper(info, device=device) if helper_class is not None: - helper_class(self, info, device).run() + try: + helper_class(self, info, device).run() + except DeviceTreeError as e: + log.error("error handling formatting on %s: %s", device.name, str(e)) log.info("got format: %s", device.format)