|
Vojtech Trefny |
7f9bb7 |
From 46335861073882b7162221fc0995dc1df3c67749 Mon Sep 17 00:00:00 2001
|
|
Vojtech Trefny |
7f9bb7 |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Vojtech Trefny |
7f9bb7 |
Date: Fri, 6 Aug 2021 16:37:51 +0200
|
|
Vojtech Trefny |
7f9bb7 |
Subject: [PATCH] Improve error message printed for missing dependecies
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
The existing error message can be confusing for people that don't
|
|
Vojtech Trefny |
7f9bb7 |
know internals of blivet and libblockdev and the information what
|
|
Vojtech Trefny |
7f9bb7 |
is actually broken or not installed on the system is missing
|
|
Vojtech Trefny |
7f9bb7 |
completely. Example for LVM VDO with missing kvdo module:
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
Before:
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
device type lvmvdopool requires unavailable_dependencies:
|
|
Vojtech Trefny |
7f9bb7 |
libblockdev lvm plugin (vdo technology)
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
After:
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
device type lvmvdopool requires unavailable_dependencies:
|
|
Vojtech Trefny |
7f9bb7 |
libblockdev lvm plugin (vdo technology):
|
|
Vojtech Trefny |
7f9bb7 |
libblockdev plugin lvm is loaded but some required technologies
|
|
Vojtech Trefny |
7f9bb7 |
are not available (BD_LVM_TECH_VDO: Kernel module 'kvdo' not
|
|
Vojtech Trefny |
7f9bb7 |
available)
|
|
Vojtech Trefny |
7f9bb7 |
---
|
|
Vojtech Trefny |
7f9bb7 |
blivet/deviceaction.py | 2 +-
|
|
Vojtech Trefny |
7f9bb7 |
blivet/tasks/availability.py | 4 ++--
|
|
Vojtech Trefny |
7f9bb7 |
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
|
|
Vojtech Trefny |
7f9bb7 |
index 56e29215..0458e4be 100644
|
|
Vojtech Trefny |
7f9bb7 |
--- a/blivet/deviceaction.py
|
|
Vojtech Trefny |
7f9bb7 |
+++ b/blivet/deviceaction.py
|
|
Vojtech Trefny |
7f9bb7 |
@@ -173,7 +173,7 @@ class DeviceAction(util.ObjectID):
|
|
Vojtech Trefny |
7f9bb7 |
def _check_device_dependencies(self):
|
|
Vojtech Trefny |
7f9bb7 |
unavailable_dependencies = self.device.unavailable_dependencies
|
|
Vojtech Trefny |
7f9bb7 |
if unavailable_dependencies:
|
|
Vojtech Trefny |
7f9bb7 |
- dependencies_str = ", ".join(str(d) for d in unavailable_dependencies)
|
|
Vojtech Trefny |
7f9bb7 |
+ dependencies_str = ", ".join("%s:\n%s" % (str(d), ", ".join(d.availability_errors)) for d in unavailable_dependencies)
|
|
Vojtech Trefny |
7f9bb7 |
raise DependencyError("device type %s requires unavailable_dependencies: %s" % (self.device.type, dependencies_str))
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
def apply(self):
|
|
Vojtech Trefny |
7f9bb7 |
diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py
|
|
Vojtech Trefny |
7f9bb7 |
index 1fd80590..1537f3f5 100644
|
|
Vojtech Trefny |
7f9bb7 |
--- a/blivet/tasks/availability.py
|
|
Vojtech Trefny |
7f9bb7 |
+++ b/blivet/tasks/availability.py
|
|
Vojtech Trefny |
7f9bb7 |
@@ -224,7 +224,7 @@ class BlockDevMethod(Method):
|
|
Vojtech Trefny |
7f9bb7 |
try:
|
|
Vojtech Trefny |
7f9bb7 |
self._tech_info.check_fn(tech, mode)
|
|
Vojtech Trefny |
7f9bb7 |
except GLib.GError as e:
|
|
Vojtech Trefny |
7f9bb7 |
- errors.append(str(e))
|
|
Vojtech Trefny |
7f9bb7 |
+ errors.append("%s: %s" % (tech.value_name, e.message))
|
|
Vojtech Trefny |
7f9bb7 |
return errors
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
def availability_errors(self, resource):
|
|
Vojtech Trefny |
7f9bb7 |
@@ -242,7 +242,7 @@ class BlockDevMethod(Method):
|
|
Vojtech Trefny |
7f9bb7 |
tech_missing = self._check_technologies()
|
|
Vojtech Trefny |
7f9bb7 |
if tech_missing:
|
|
Vojtech Trefny |
7f9bb7 |
return ["libblockdev plugin %s is loaded but some required "
|
|
Vojtech Trefny |
7f9bb7 |
- "technologies are not available:\n%s" % (self._tech_info.plugin_name, tech_missing)]
|
|
Vojtech Trefny |
7f9bb7 |
+ "technologies are not available (%s)" % (self._tech_info.plugin_name, "; ".join(tech_missing))]
|
|
Vojtech Trefny |
7f9bb7 |
else:
|
|
Vojtech Trefny |
7f9bb7 |
return []
|
|
Vojtech Trefny |
7f9bb7 |
|
|
Vojtech Trefny |
7f9bb7 |
--
|
|
Vojtech Trefny |
7f9bb7 |
2.31.1
|
|
Vojtech Trefny |
7f9bb7 |
|