[PATCH 4/8] Make the edd dict a singleton and support bios specs in resolveDevice.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 pyanaconda/packaging/yumpayload.py   |    1 -
 pyanaconda/storage/devicelibs/edd.py |    4 +++-
 pyanaconda/storage/devicetree.py     |   12 ++++++++----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index e948da7..a11bb6a 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -488,7 +488,6 @@ reposdir=%s
             else:
                 devspec = method.partition
 
-            # FIXME: teach DeviceTree.resolveDevice about biospart
             device = storage.devicetree.resolveDevice(devspec)
             self._setUpMedia(device)
             self.install_device = device
diff --git a/pyanaconda/storage/devicelibs/edd.py b/pyanaconda/storage/devicelibs/edd.py
index ff244e4..30e8004 100644
--- a/pyanaconda/storage/devicelibs/edd.py
+++ b/pyanaconda/storage/devicelibs/edd.py
@@ -202,7 +202,7 @@ def get_edd_dict(devices):
     """
     mbr_dict = collect_mbrs(devices)
     edd_entries_dict = collect_edd_data()
-    edd_dict = {}
+    global edd_dict
     for (edd_number, edd_entry) in edd_entries_dict.items():
         log.debug("edd: data extracted from 0x%x:\n%s" % (edd_number, edd_entry))
         matcher = EddMatcher(edd_entry)
@@ -227,3 +227,5 @@ def get_edd_dict(devices):
             continue
         log.error("edd: unable to match edd entry 0x%x" % edd_number)
     return edd_dict
+
+edd_dict = {}
diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 02a621b..9ef33ed 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -38,6 +38,7 @@ import devicelibs.dm
 import devicelibs.lvm
 import devicelibs.mpath
 import devicelibs.loop
+import devicelibs.edd
 from udev import *
 from pyanaconda import iutil
 from pyanaconda import platform
@@ -2073,8 +2074,6 @@ class DeviceTree(object):
                 (uuid.startswith("'") and uuid.endswith("'"))):
                 uuid = uuid[1:-1]
             device = self.uuids.get(uuid)
-            if device is None:
-                log.error("failed to resolve device %s" % devspec)
         elif devspec.startswith("LABEL="):
             # device-by-label
             label = devspec.partition("=")[2]
@@ -2082,8 +2081,13 @@ class DeviceTree(object):
                 (label.startswith("'") and label.endswith("'"))):
                 label = label[1:-1]
             device = self.labels.get(label)
-            if device is None:
-                log.error("failed to resolve device %s" % devspec)
+        elif re.match(r'(0x)?[A-Za-z0-9]{2}(p\d+)?$', devspec):
+            # BIOS drive number
+            spec = int(devspec, 16)
+            for (edd_name, edd_number) in devicelibs.edd.edd_dict.items():
+                if edd_number == spec:
+                    device = self.getDeviceByName(edd_name)
+                    break
         else:
             if not devspec.startswith("/dev/"):
                 devspec = "/dev/" + devspec
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux