Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
cbf1c3fd70
!137 Fix intel biosraid can't get device name causing crashed
From: @funningc0217 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2024-08-28 07:20:55 +00:00
Yurii.Huang
b01532677f upstream: Fix-intel-biosraid-can-t-get-device-name-causing-crashed 2024-08-27 19:59:05 +08:00
openeuler-ci-bot
9506a4c118
!92 Exclude unusable disks from PartitionFactory
From: @han_hui_hui 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-12-27 06:56:54 +00:00
han_hui_hui
a0f963143d Exclude unusable disks from PartitionFactory 2022-12-27 03:34:47 +00:00
openeuler-ci-bot
494287135d
!83 fix Incomplete Chineseization of disk mount
From: @wanglmb 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-12-12 03:21:39 +00:00
wanglimin
e9e52382aa fix Incomplete-Chineseization-of-disk-mount 2022-12-12 10:25:53 +08:00
openeuler-ci-bot
3d41a4d186
!73 修复关于忽略隐藏设备的日志信息
From: @yue-yuankun 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-11-01 08:16:13 +00:00
yueyuankun
700e044d3d Fix logging information about ignoring hidden devices 2022-09-01 13:28:54 +08:00
openeuler-ci-bot
a3b1b776a5
!70 ignore devices marked as hidden in sysfs and fix reading hidden sysfs attribute
From: @wanglu210 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-08-04 02:56:48 +00:00
wanglu210
7b6c97c380 ignore devices marked as hidden in sysfs and fix reading hidden sysfs attribure 2022-08-04 10:14:57 +08:00
9 changed files with 328 additions and 28 deletions

View File

@ -0,0 +1,30 @@
From 9d7d0428c81ce592c807f2cefcf7228a1b3d8789 Mon Sep 17 00:00:00 2001
From: "Yurii.Huang" <yurii.huang@dbappsecurity.com.cn>
Date: Wed, 21 Aug 2024 18:31:04 +0800
Subject: [PATCH] Fix intel biosraid can't get device name causing crashed
crashed with DiskDevice get members property
trace: 'DiskDevice' object has no attribute 'members'
changed: when ID_FS_TYPE is isw_raid_member use SYS_NAME to device name
---
blivet/udev.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/udev.py b/blivet/udev.py
index 70fc722f..667e1f3c 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -243,6 +243,10 @@ def device_get_name(udev_info):
elif device_get_format(udev_info) == "linux_raid_member":
# MD RAID member -> use SYS_NAME
name = udev_info["SYS_NAME"]
+ elif device_get_format(udev_info) == "isw_raid_member":
+ # intel software biosraid
+ # MD RAID member -> use SYS_NAME
+ name = udev_info["SYS_NAME"]
elif device_is_partition(udev_info):
# partition on RAID -> construct name from MD_DEVNAME + partition number
# for partitions on named RAID we want to use the raid name, not
--
2.20.1

View File

@ -0,0 +1,74 @@
From 5cac6005312fd6f0cb47b73571254acaff70078c Mon Sep 17 00:00:00 2001
From: wangzhiyi <wangzhiyi@xfusion.com>
Date: Tue, 22 Nov 2022 18:13:27 +0800
Subject: Sinicization"not enough free space for new device"
---
blivet/devicefactory.py | 5 +++--
po/blivet.pot | 4 ++++
po/zh_CN.po | 4 ++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index 9214ad5..3d3029e 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -39,6 +39,7 @@ from .partitioning import TotalSizeSet
from .partitioning import do_partitioning
from .size import Size
from .static_data import luks_data
+from .i18n import _
import gi
gi.require_version("BlockDev", "2.0")
@@ -704,7 +705,7 @@ class DeviceFactory(object):
# the container
size = self._get_device_size()
if size <= Size(0):
- raise DeviceFactoryError("not enough free space for new device")
+ raise DeviceFactoryError(_("not enough free space for new device"))
parents = self._get_parent_devices()
@@ -1302,7 +1303,7 @@ class LVMFactory(DeviceFactory):
self.size += self.device.size
if self.size == Size(0):
- raise DeviceFactoryError("not enough free space for new device")
+ raise DeviceFactoryError(_("not enough free space for new device"))
else:
super(LVMFactory, self)._handle_no_size()
diff --git a/po/blivet.pot b/po/blivet.pot
index 29f34b9..c8526de 100644
--- a/po/blivet.pot
+++ b/po/blivet.pot
@@ -50,6 +50,10 @@ msgstr ""
msgid "FCoE not available"
msgstr ""
+#: ../blivet/devicefactory.py:708 ../blivet/devicefactory.py:1306
+msgid "not enough free space for new device"
+msgstr ""
+
#: ../blivet/zfcp.py:62
msgid "You have not specified a device number or the number is invalid"
msgstr ""
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 480801d..05c635e 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -71,6 +71,10 @@ msgstr ""
msgid "FCoE not available"
msgstr "FCoE 不可用"
+#: ../blivet/devicefactory.py:708 ../blivet/devicefactory.py:1306
+msgid "not enough free space for new device"
+msgstr "新设备没有足够的剩余空间"
+
#: ../blivet/zfcp.py:62
msgid "You have not specified a device number or the number is invalid"
msgstr "您没有指定设备号码或号码无效"
--
2.27.0

View File

@ -0,0 +1,33 @@
From b20753ac6db14999270d71387309baa9270aa927 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 13 Jan 2022 17:27:08 +0100
Subject: [PATCH] Show better error when using unitialized disk in
do_partitioning
Now all we get is "KeyError: '/dev/sda'" for example.
Related: rhbz#2017432
Conflict:NA
Reference:https://github.com/storaged-project/blivet/commit/b20753ac6db14999270d71387309baa9270aa927
---
blivet/partitioning.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index f12ec3c9e..ce77e4eb7 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -764,7 +764,10 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None):
growth = 0 # in sectors
# loop through disks
for _disk in req_disks:
- disklabel = disklabels[_disk.path]
+ try:
+ disklabel = disklabels[_disk.path]
+ except KeyError:
+ raise PartitioningError("Requested disk %s doesn't have a usable disklabel for partitioning" % _disk.name)
best = None
current_free = free
try:

View File

@ -0,0 +1,49 @@
From 61c09c6922748877595272479d68270fe442f3d4 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 13 Jan 2022 16:53:30 +0100
Subject: [PATCH] Exclude unusable disks from PartitionFactory
We already remove disks that are too small or not partitionable
in the PartitionSetFactory which allows us to create partitions
on multipath devices where Anaconda tells us to use both the mpath
device and the backing disks, we should do the same for the
PartitionFactory.
Resolves: rhbz#2017432
Conflict:NA
Reference:https://github.com/storaged-project/blivet/commit/61c09c6922748877595272479d68270fe442f3d4
---
blivet/devicefactory.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index e6b8c1fad..2499484bf 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -1065,6 +1065,24 @@ def _get_new_device(self, *args, **kwargs):
**kwargs)
return device
+ def _configure(self):
+ disks = []
+ for disk in self.disks:
+ if not disk.partitioned:
+ log.debug("removing unpartitioned disk %s", disk.name)
+ elif not disk.format.supported:
+ log.debug("removing disk with unsupported format %s", disk.name)
+ else:
+ disks.append(disk)
+
+ if not disks:
+ raise DeviceFactoryError("no usable disks specified for partition")
+
+ log.debug("setting new factory disks to %s", [d.name for d in disks])
+ self.disks = disks # pylint: disable=attribute-defined-outside-init
+
+ super(PartitionFactory, self)._configure()
+
def _set_disks(self):
self.raw_device.req_disks = self.disks[:]

View File

@ -0,0 +1,25 @@
From d4d8224637d6967418c62de61f8673d520e16243 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 7 Dec 2020 18:48:36 +0100
Subject: [PATCH] Fix logging information about ignoring hidden devices
---
blivet/populator/populator.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
index 40623714..75bb1741 100644
--- a/blivet/populator/populator.py
+++ b/blivet/populator/populator.py
@@ -250,7 +250,7 @@ class PopulatorMixin(object):
log.info("scanning %s (%s)...", name, sysfs_path)
if udev.device_is_hidden(info):
- log.info("device %s is marked as hidden in sysfs, ignoring")
+ log.info("device %s is marked as hidden in sysfs, ignoring", name)
return
# make sure we note the name of every device we see
--
2.27.0

View File

@ -0,0 +1,30 @@
From ceeb75df8362f848cd2c11caaba04c5efdc4629d Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 30 Jul 2020 12:36:35 +0200
Subject: [PATCH] Fix reading hidden sysfs attribute
util.get_sysfs_attr returns a string so bool(hidden) is always
True and we hide all devices.
Reference:https://github.com/storaged-project/blivet/commit/191a6961f13bd868052346047d0c1dc24b19f09e
Conflict:NA
---
blivet/udev.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/blivet/udev.py b/blivet/udev.py
index 8b3fc58..5788a5e 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -1004,4 +1004,7 @@ def device_is_nvdimm_namespace(info):
def device_is_hidden(info):
sysfs_path = device_get_sysfs_path(info)
hidden = util.get_sysfs_attr(sysfs_path, "hidden")
- return bool(hidden)
+ if not hidden or not hidden.isnumeric():
+ return False
+
+ return bool(int(hidden))
--
2.27.0

View File

@ -0,0 +1,47 @@
From 7297046bdeb98449f4b224d13548ea97aa411aad Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 21 Jul 2020 13:26:40 +0200
Subject: [PATCH] Ignore devices marked as hidden in sysfs(#1856974)
NVMe multipath devices have a special internal hidden devices that
are visible in /sys/block but not directly usable so we should
ignore these as well as all devices with the hidden attribute.
Reference:https://github.com/storaged-project/blivet/commit/8957eb1f82a37542ea1ae3990b6068b3cf90a3be
Conflict:NA
---
blivet/populator/populator.py | 3 +++
blivet/udev.py | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
index 465c272..1d6daa6 100644
--- a/blivet/populator/populator.py
+++ b/blivet/populator/populator.py
@@ -247,6 +247,9 @@ class PopulatorMixin(object):
return
log.info("scanning %s (%s)...", name, sysfs_path)
+ if udev.device_is_hidden(info):
+ log.info("device %s is marked as hidden in sysfs, ignoring")
+ return
# make sure we note the name of every device we see
self._add_name(name)
diff --git a/blivet/udev.py b/blivet/udev.py
index c85eb3d..8b3fc58 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -999,3 +999,9 @@ def device_is_nvdimm_namespace(info):
devname = info.get("DEVNAME", "")
ninfo = blockdev.nvdimm_namespace_get_devname(devname)
return ninfo is not None
+
+
+def device_is_hidden(info):
+ sysfs_path = device_get_sysfs_path(info)
+ hidden = util.get_sysfs_attr(sysfs_path, "hidden")
+ return bool(hidden)
--
2.27.0

View File

@ -1,26 +0,0 @@
From 00cdf3f0ace5f4d5407dbf610f056fef667c1cd2 Mon Sep 17 00:00:00 2001
From: bitcoffeeiux <liuxin264@huawei.com>
Date: Fri, 4 Jun 2021 02:23:37 +0800
Subject: [PATCH] function allocate_partitions threw an exception
while adding /boot partitions to a RAID disk
---
blivet/partitioning.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 40644f9..8219841 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -758,6 +758,8 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None):
growth = 0 # in sectors
# loop through disks
for _disk in req_disks:
+ if _disk.path not in disklabels:
+ continue
disklabel = disklabels[_disk.path]
best = None
current_free = free
--
2.27.0

View File

@ -3,7 +3,7 @@
Name: python-blivet
Version: 3.2.2
Release: 8
Release: 13
Epoch: 1
Summary: A python module for system storage configuration
License: LGPLv2+
@ -23,11 +23,19 @@ Patch9000: fix-the-long-hostname.patch
Patch6000: backport-Account-for-pmspare-grow-when-adjusting-thinpool-metadata.patch
Patch6001: backport-Close-fd-if-it-fails-to-read-the-device.patch
Patch6002: backport-Fix-UnboundLocalError.patch
Patch9001: huawei-fix-allocate-partitions-threw-exception-when-raid.patch
Patch6003: backport-Convert-LVM-filter-lists-to-sets.patch
Patch6004: backport-Remove-action-device-from-LVM-reject-list.patch
Patch6005: backport-Ignore-devices-marked-as-hidden-in-sysfs-1856974.patch
Patch6006: backport-Fix-reading-hidden-sysfs-attribute.patch
Patch6007: backport-Fix-logging-information-about-ignoring-hidden-device.patch
Patch9002: Incomplete-Chineseization-of-disk-mount.patch
Patch9003: 9003-Fix-intel-biosraid-can-t-get-device-name-causing-crashed.patch
Patch6008: backport-Exclude-unusable-disks-from-PartitionFactory-1.patch
Patch6009: backport-Exclude-unusable-disks-from-PartitionFactory-2.patch
%description
The python-blivet package is a python module for examining and modifying
storage configuration.
@ -127,6 +135,36 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install
%doc README
%changelog
* Tue Aug 27 2024 Yurii.Huang<yurii.huang@dbappsecurity.com.cn> - 1:3.2.2-13
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix isw_raid_member disk get members property crashed
* Tue Dec 27 2022 hanhuihui<hanhuihui5@huawei.com> - 1:3.2.2-12
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Exclude unusable disks from PartitionFactory
* Thu Dec 08 2022 wanglimin<wanglimin@xfusion.com> - 1:3.2.2-11
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Incomplete Chineseization of disk mount
* Thu Sep 1 2022 yueyuankun <yueyuankun@kylinos.cn> - 1:3.2.2-10
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix logging information about ignoring hidden devices
* Thu Aug 4 2022 wanglu <wanglu210@huawei.com> - 1:3.2.2-9
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:ignore devices marked as hidden in sysfs and fix reading hidden sysfs attribute
* Fri Dec 10 2021 yanan <yanan@huawei.com> - 3.2.2-8
- Type:bugfix
- ID:NA