anaconda/bugfix-Fix-issue-when-ns_info-cannot-be-retrieved-for-NVDim.patch
bitcoffee 6da3b93544 Fix issue when ns_info cannot be retrieved for NVDimm namespace
(cherry picked from commit e7cac4650b62d99c907fb404eb6e6d088f298a5d)
2021-05-19 15:20:29 +08:00

49 lines
1.8 KiB
Diff

From 49f6e0e64accb5a1e6590bb08f7986fe7eaec2de Mon Sep 17 00:00:00 2001
From: Jiri Konecny <jkonecny@redhat.com>
Date: Thu, 29 Oct 2020 10:08:09 +0100
Subject: [PATCH] Fix issue when ns_info cannot be retrieved for NVDimm
namespace
If we don't skip this part the uncaught exception will raise because we
are
trying to concatenate string and None types.
This is happening when NVDIMM namespace is set to DEVDAX mode. In this
mode
there is no device to be returned so we will got None from blivet.
Resolves: rhbz#1891827
(cherry picked from commit 6afc375b164a802e26802ec4ba54d3446c078091)
---
pyanaconda/modules/storage/nvdimm/nvdimm.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/modules/storage/nvdimm/nvdimm.py b/pyanaconda/modules/storage/nvdimm/nvdimm.py
index 4476dd1..5b9c9dc 100644
--- a/pyanaconda/modules/storage/nvdimm/nvdimm.py
+++ b/pyanaconda/modules/storage/nvdimm/nvdimm.py
@@ -101,6 +101,12 @@ class NVDIMMModule(KickstartBaseModule):
devices_to_ignore = set()
for ns_name, ns_info in nvdimm.namespaces.items():
+ # this is happening when namespace is set to DEVDAX mode - block device is not present
+ if ns_info.blockdev is None:
+ log.debug("%s will be skipped - NVDIMM namespace block device information "
+ "can't be retrieved", ns_name)
+ continue
+
info = udev.get_device(device_node="/dev/" + ns_info.blockdev)
if info and udev.device_get_format(info) == "iso9660":
@@ -116,8 +122,7 @@ class NVDIMMModule(KickstartBaseModule):
else:
continue
- if ns_info.blockdev:
- devices_to_ignore.add(ns_info.blockdev)
+ devices_to_ignore.add(ns_info.blockdev)
return devices_to_ignore