[master 14/24] edd: Add sysfslink for mbr matches

vathpela installerbot-noreply at redhat.com
Fri Nov 6 18:31:09 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 1112771..d81ac12 100644
--- a/blivet/devicelibs/edd.py
+++ b/blivet/devicelibs/edd.py
@@ -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
 
diff --git a/tests/devicelibs_test/edd_test.py b/tests/devicelibs_test/edd_test.py
index 0185add..7eae927 100644
--- a/tests/devicelibs_test/edd_test.py
+++ b/tests/devicelibs_test/edd_test.py
@@ -161,14 +161,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/23c60428e29e9957cab004d89b8bff9d18fdbb58


More information about the anaconda-patches mailing list