rhel-system-roles/storage-partition-name.diff

31 lines
1.0 KiB
Diff
Raw Normal View History

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