rhel-system-roles/storage-partition-name.diff
DistroBaker f6ce71d308 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/linux-system-roles.git#490700ef996ddf949520cb4c0fedd290cc657aed
2021-02-22 23:36:10 +01:00

31 lines
1.0 KiB
Diff

commit effb7faf20301ddcee8ee36a1b156a0b9f006bb0
Author: David Lehman <dlehman@redhat.com>
Date: Tue Aug 4 16:00:33 2020 -0400
Be smarter in choosing expected partition name.
BlivetVolume._get_device_id is only used to look up pre-existing
volumes, so we don't have to try too hard to guess it by name.
We can just see if the disk has a single partition and, if so,
return the name of that partition.
Fixes: #141
diff --git a/library/blivet.py b/library/blivet.py
index eb8bb11..0f7ce98 100644
--- a/library/blivet.py
+++ b/library/blivet.py
@@ -554,7 +554,11 @@ class BlivetPartitionVolume(BlivetVolume):
return self._device.raw_device.type == 'partition'
def _get_device_id(self):
- return self._blivet_pool._disks[0].name + '1'
+ device_id = None
+ if self._blivet_pool._disks[0].partitioned and len(self._blivet_pool._disks[0].children) == 1:
+ device_id = self._blivet_pool._disks[0].children[0].name
+
+ return device_id
def _resize(self):
pass