Blame SOURCES/storage-partition-name.diff

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