[master 12/16] edd: Add sysfslink for mbr matches

vathpela installerbot-noreply at redhat.com
Wed Oct 28 15:35:03 UTC 2015


From: Peter Jones <pjones at redhat.com>

Signed-off-by: Peter Jones <pjones at redhat.com>
---
 blivet/devicelibs/edd.py          |  3 +++
 tests/devicelibs_test/edd_test.py | 10 +++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/blivet/devicelibs/edd.py b/blivet/devicelibs/edd.py
index 0419470..02f2436 100644
--- a/blivet/devicelibs/edd.py
+++ b/blivet/devicelibs/edd.py
@@ -523,8 +523,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
 
diff --git a/tests/devicelibs_test/edd_test.py b/tests/devicelibs_test/edd_test.py
index adf0f76..27dca11 100644
--- a/tests/devicelibs_test/edd_test.py
+++ b/tests/devicelibs_test/edd_test.py
@@ -156,14 +156,18 @@ 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)


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


More information about the anaconda-patches mailing list