Skip to content

Commit

Permalink
General protection against tracebacks during populate.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dwlehman committed Jul 10, 2019
1 parent c5891a7 commit 6583721
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions blivet/populator/populator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 6583721

Please sign in to comment.