Skip to content

Commit

Permalink
edd: Add sysfslink for mbr matches
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Jones <pjones@redhat.com>
  • Loading branch information
vathpela committed Nov 6, 2015
1 parent 52f6c29 commit 49b3721
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions blivet/devicelibs/edd.py
Expand Up @@ -529,8 +529,11 @@ def match_via_mbrsigs(self, mbr_dict):
This will obviously fail for a fresh drive/image, but in extreme
cases can also show false positives for randomly matching data.
"""
sysblock = "%s/%s" % (fsroot, "/sys/block")
for (name, mbr_sig) in mbr_dict.items():
if mbr_sig == self.edd.mbr_sig:
self.edd.sysfslink = util.sysfs_readlink(sysblock, link=name,
root=fsroot)
return name
return None

Expand Down
9 changes: 6 additions & 3 deletions tests/devicelibs_test/edd_test.py
Expand Up @@ -161,14 +161,17 @@ 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,
usb_serial=0x30302e31,
interface="USB \tserial_number: 30302e31",
sysfspath="/sys/firmware/edd/int13_dev81"),
sysfspath="/sys/firmware/edd/int13_dev81",
sysfslink="../devices/pci0000:00/0000:00:1d.0/"
"usb4/4-1/4-1.2/4-1.2:1.0/host6/target6:0:0/"
"6:0:0:0/block/sdb"),
}

edd_dict = edd.get_edd_dict(devices)
Expand Down

0 comments on commit 49b3721

Please sign in to comment.