Compare commits

...

3 Commits
rawhide ... f34

Author SHA1 Message Date
Vojtech Trefny 4225835dea Fix resolving devices with names that look like BIOS drive number
Resolves: rhbz#1960798
2021-06-29 08:42:22 +02:00
Vojtech Trefny d08f8ca163 Avoid AttributeError for DiskLabel formats without disklabel type (#1945914) 2021-04-12 13:25:18 +02:00
Vojtech Trefny 312869d19d New version 3.3.3
- apply compression settings from blivet.flags.btrfs_compression (#1926892)
2021-02-18 15:39:24 +01:00
5 changed files with 131 additions and 4 deletions

2
.gitignore vendored
View File

@ -131,3 +131,5 @@
/blivet-3.3.1-tests.tar.gz
/blivet-3.3.2-tests.tar.gz
/blivet-3.3.2.tar.gz
/blivet-3.3.3-tests.tar.gz
/blivet-3.3.3.tar.gz

View File

@ -0,0 +1,38 @@
From bf70f3625e517b73ed45c0d5d40c210124ccd4bc Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 6 Apr 2021 14:59:41 +0200
Subject: [PATCH] Avoid AttributeError for DiskLabel formats without disklabel
type
Simple instance of DiskLabel without label_type specified in the
constructor results in a AttributeError when trying to print the
format name. This makes sure the name is always valid.
Resolves: rhbz#1945914
---
blivet/formats/disklabel.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
index 7102457b..c8148309 100644
--- a/blivet/formats/disklabel.py
+++ b/blivet/formats/disklabel.py
@@ -313,13 +313,13 @@ def sector_size(self):
@property
def name(self):
- if self.supported:
- _str = "%(name)s (%(type)s)"
+ if self.label_type is None:
+ return "%(name)s" % {"name": _(self._name)}
+ elif self.supported:
+ return "%(name)s (%(type)s)" % {"name": _(self._name), "type": self.label_type.upper()}
else:
# Translators: Name for an unsupported disklabel; e.g. "Unsupported partition table"
- _str = _("Unsupported %(name)s")
-
- return _str % {"name": _(self._name), "type": self.label_type.upper()}
+ return _("Unsupported %(name)s") % {"name": _(self._name)}
@property
def size(self):

View File

@ -0,0 +1,75 @@
From 3f27589b8f69a039521a0b2275527fe870567f2d Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 18 May 2021 12:54:02 +0200
Subject: [PATCH] Fix resolving devices with names that look like BIOS drive
number
A RAID array named "10" will not be resolved because we try to
resolve it using EDD data and after this lookup fails, we don't
try the name.
Resolves: rhbz#1960798
---
blivet/devicetree.py | 18 +++++++++---------
tests/devicetree_test.py | 4 ++++
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 88e9f0e5..339a3cd2 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -634,20 +634,20 @@ class DeviceTreeBase(object):
(label.startswith("'") and label.endswith("'"))):
label = label[1:-1]
device = self.labels.get(label)
- elif re.match(r'(0x)?[A-Fa-f0-9]{2}(p\d+)?$', devspec):
- # BIOS drive number
- (drive, _p, partnum) = devspec.partition("p")
- spec = int(drive, 16)
- for (edd_name, edd_number) in self.edd_dict.items():
- if edd_number == spec:
- device = self.get_device_by_name(edd_name + partnum)
- break
elif options and "nodev" in options.split(","):
device = self.get_device_by_name(devspec)
if not device:
device = self.get_device_by_path(devspec)
else:
- if not devspec.startswith("/dev/"):
+ if re.match(r'(0x)?[A-Fa-f0-9]{2}(p\d+)?$', devspec):
+ # BIOS drive number
+ (drive, _p, partnum) = devspec.partition("p")
+ spec = int(drive, 16)
+ for (edd_name, edd_number) in self.edd_dict.items():
+ if edd_number == spec:
+ device = self.get_device_by_name(edd_name + partnum)
+
+ if not device and not devspec.startswith("/dev/"):
device = self.get_device_by_name(devspec)
if not device:
devspec = "/dev/" + devspec
diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py
index 11f8469d..b033343d 100644
--- a/tests/devicetree_test.py
+++ b/tests/devicetree_test.py
@@ -49,6 +49,9 @@ class DeviceTreeTestCase(unittest.TestCase):
dev3 = StorageDevice("sdp2", exists=True)
dt._add_device(dev3)
+ dev4 = StorageDevice("10", exists=True)
+ dt._add_device(dev4)
+
dt.edd_dict.update({"dev1": 0x81,
"dev2": 0x82})
@@ -62,6 +65,7 @@ class DeviceTreeTestCase(unittest.TestCase):
self.assertEqual(dt.resolve_device("0x82"), dev2)
self.assertEqual(dt.resolve_device(dev3.name), dev3)
+ self.assertEqual(dt.resolve_device(dev4.name), dev4)
def test_device_name(self):
# check that devicetree.names property contains all device's names
--
2.31.1

View File

@ -19,11 +19,11 @@
Summary: A python module for system storage configuration
Name: python-blivet
Url: https://storageapis.wordpress.com/projects/blivet
Version: 3.3.2
Version: 3.3.3
#%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 2%{?prerelease}%{?dist}
Release: 3%{?prerelease}%{?dist}
Epoch: 1
License: LGPLv2+
%global realname blivet
@ -35,6 +35,9 @@ Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realver
Patch0: 0001-remove-btrfs-plugin.patch
%endif
Patch1: 0002-Avoid-AttributeError-for-DiskLabel-formats-without-disklabel-type.patch
Patch2: 0003-Fix-resolving-devices-with-names-that-look-like-BIOS.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
%global partedver 1.8.1
@ -196,6 +199,15 @@ configuration.
%endif
%changelog
* Tue Jun 29 2021 Vojtech Trefny <vtrefny@redhat.com> - 3.3.3-3
- Fix resolving devices with names that look like BIOS drive number (#1960798)
* Mon Apr 12 2021 Vojtech Trefny <vtrefny@redhat.com> - 3.3.3-2
- Avoid AttributeError for DiskLabel formats without disklabel type (#1945914)
* Thu Feb 18 2021 Vojtech Trefny <vtrefny@redhat.com> - 3.3.3-1
- apply compression settings from blivet.flags.btrfs_compression (#1926892) (michel)
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (blivet-3.3.2-tests.tar.gz) = 8c07d3cac7a70185f416076d39ec51729f977d101ba5730451109d835318e3636c4fc30420451f4f91c2b769c2c1e204db758211c9faf477add608f1338d375e
SHA512 (blivet-3.3.2.tar.gz) = 4bc329ef0e80676c297e25f7649364ea5444bbf526ac56ec7048234b056d57a4b78a41858ef609de0a01bc98a27b92a893c364c4ea45277e4b527cc5d58db962
SHA512 (blivet-3.3.3-tests.tar.gz) = d884db3699762563d8ec9968f127a694a29f089eb783cd74adcadc41b9eccc25416cb1a32d81c9534e20b206c060d0b117fb2846778f879611fc2e511ef4cc59
SHA512 (blivet-3.3.3.tar.gz) = c4eb96f6856a6dc7c6cd78bda064f5dd890951714a627b231488327b8790f16160a088842c9c3627ecb8551b25379402a4af9e777e8c610e7d5810baf5a0a41a