[master 7/16] edd: add EddEntry.bios_device_number

vathpela installerbot-noreply at redhat.com
Fri Nov 6 20:58:28 UTC 2015


From: Peter Jones <pjones at redhat.com>

This lets us tell (and log) which edd entry we're probing.

Signed-off-by: Peter Jones <pjones at redhat.com>
---
 blivet/devicelibs/edd.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/blivet/devicelibs/edd.py b/blivet/devicelibs/edd.py
index d81ac12..73c7d22 100644
--- a/blivet/devicelibs/edd.py
+++ b/blivet/devicelibs/edd.py
@@ -36,6 +36,7 @@
 testdata_log = logging.getLogger("testdata")
 testdata_log.setLevel(logging.DEBUG)
 
+re_bios_device_number = re.compile(r'.*/int13_dev(\d+)/*$')
 re_host_bus_pci = re.compile(r'^(PCIX|PCI|XPRS|HTPT)\s*(\S*)\s*channel: (\S*)\s*$')
 re_interface_atapi = re.compile(r'^ATAPI\s*device: (\S*)\s*lun: (\S*)\s*$')
 re_interface_ata = re.compile(r'^ATA\s*device: (\S*)\s*$')
@@ -75,6 +76,10 @@ def __init__(self, sysfspath):
         """ sysfspath is the path we're probing
         """
 
+        match = re_bios_device_number.match(sysfspath)
+        self.bios_device_number = int(match.group(1), base=16)
+        """ The device number from the EDD path """
+
         self.sysfslink = None
         """ The path /sys/block/BLAH is a symlink link to once we've resolved
             that this is a particular device.  Used for logging later.
@@ -540,12 +545,11 @@ def match_via_mbrsigs(self, mbr_dict):
 
 def collect_edd_data():
     edd_data_dict = {}
-    exp = re.compile(r'.*/int13_dev(\d+)$')
     globstr = os.path.join(fsroot, "sys/firmware/edd/int13_dev*")
     testdata_log.debug("sysfs glob: %s", globstr[len(fsroot):])
     for path in glob.glob(globstr):
         testdata_log.debug("sysfs glob match: %s", path[len(fsroot):])
-        match = exp.match(path)
+        match = re_bios_device_number.match(path)
         biosdev = int("0x%s" % (match.group(1),), base=16)
         log.debug("edd: found device 0x%x at %s", biosdev, path[len(fsroot):])
         edd_data_dict[biosdev] = EddEntry(path[len(fsroot):])


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/48f7184708eb463b984fc60058b30ca7f65725d3


More information about the anaconda-patches mailing list