Look the disk up for a partition by name not sys_name (#1445302)

This commit is contained in:
Vojtech Trefny 2017-05-09 13:43:11 +02:00
parent fbe20bb697
commit 3bb4a42fc2
2 changed files with 43 additions and 1 deletions

View File

@ -5,7 +5,7 @@ Version: 2.1.7
#%%global prerelease .b1
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 8%{?prerelease}%{?dist}
Release: 9%{?prerelease}%{?dist}
Epoch: 1
License: LGPLv2+
Group: System Environment/Libraries
@ -19,6 +19,7 @@ Patch0: 0001-Fix-unknown-SAS-device-sysfs-parsing.patch
Patch1: https://github.com/rhinstaller/blivet/pull/530.patch
Patch2: rhbz1383873.patch
Patch3: rhbz1033778.patch
Patch4: rhbz1445302.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -73,6 +74,7 @@ configuration.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
rm -rf %{py3dir}
cp -a . %{py3dir}

40
rhbz1445302.patch Normal file
View File

@ -0,0 +1,40 @@
From 7ef50d3b7061353838e44c8dc202eb5f6b012f40 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Thu, 4 May 2017 13:03:06 +0200
Subject: [PATCH] Look the disk up for a partition by name not sys_name
udev.device_get_partition_disk() returns the device name as given
by device_get_name() not sys_name. So when trying to find a match
we need to compare it to the same value for devices we iterate
over.
Also don't call resolve_devspec() on the returned value,
udev.device_get_partition_disk() is already doing it.
Resolves: rhbz#1445302
---
blivet/populator/helpers/partition.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/blivet/populator/helpers/partition.py b/blivet/populator/helpers/partition.py
index 617b5e7..73b15f1 100644
--- a/blivet/populator/helpers/partition.py
+++ b/blivet/populator/helpers/partition.py
@@ -57,13 +57,13 @@ def run(self):
return device
disk = None
- sys_name = udev.device_get_partition_disk(self.data)
- if sys_name:
- disk_name = udev.resolve_devspec(sys_name)
+ disk_name = udev.device_get_partition_disk(self.data)
+ if disk_name:
disk = self._devicetree.get_device_by_name(disk_name)
if disk is None:
# create a device instance for the disk
- disk_info = next((i for i in udev.get_devices() if i.sys_name == sys_name), None)
+ disk_info = next((i for i in udev.get_devices()
+ if udev.device_get_name(i) == disk_name), None)
if disk_info is not None:
self._devicetree.handle_device(disk_info)
disk = self._devicetree.get_device_by_name(disk_name)