[master 10/24] edd: add EddEntry.bios_device_number
vathpela
installerbot-noreply at redhat.com
Fri Nov 6 18:31:05 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 ++++++--
tests/devicelibs_test/edd_test.py | 5 ++---
2 files changed, 8 insertions(+), 5 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):])
diff --git a/tests/devicelibs_test/edd_test.py b/tests/devicelibs_test/edd_test.py
index b7453a8..dbcf31e 100644
--- a/tests/devicelibs_test/edd_test.py
+++ b/tests/devicelibs_test/edd_test.py
@@ -159,9 +159,8 @@ def test_get_edd_dict_sata_usb(self):
pci_dev="00:1f.2", channel=255, ata_device=1,
interface="SATA \tdevice: 1",
sysfspath="/sys/firmware/edd/int13_dev80",
- sysfslink="../devices/pci0000:00/0000:00:1f.2/"\
- "ata2/host1/target1:0:0/1:0:0:0/"\
- "block/sda"),
+ sysfslink="../devices/pci0000:00/0000:00:1f.2/ata2"\
+ "/host1/target1:0:0/1:0:0:0/block/sda"),
0x81: FakeEddEntry(version="0x21", mbr_sig="0x96a20d28",
sectors=31293440, host_bus="PCI", type="USB",
pci_dev="ff:ff.255", channel=255,
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/7f2ca6de47f21da9c42253367153a07ed0d538a4
More information about the anaconda-patches
mailing list