[rhel6-branch 2/2] edd: do not traceback with cciss devices.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves: rhbz#723194
---
 storage/devicelibs/edd.py            |    7 +++++--
 tests/storage/devicelibs/edd_test.py |   17 +++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/storage/devicelibs/edd.py b/storage/devicelibs/edd.py
index 9563af6..86abca4 100644
--- a/storage/devicelibs/edd.py
+++ b/storage/devicelibs/edd.py
@@ -84,8 +84,11 @@ class EddEntry(object):
         hbus = self._read_file(os.path.join(sysfspath, "host_bus"))
         if hbus:
             match = re_host_bus.match(hbus)
-            self.pci_dev = match.group(1)
-            self.channel = int(match.group(2))
+            if match:
+                self.pci_dev = match.group(1)
+                self.channel = int(match.group(2))
+            else:
+                log.warning("edd: can not match host_bus: %s" % hbus)
 
 class EddMatcher(object):
     """ This object tries to match given entry to a disk device name.
diff --git a/tests/storage/devicelibs/edd_test.py b/tests/storage/devicelibs/edd_test.py
index e4cf09b..00a91b4 100644
--- a/tests/storage/devicelibs/edd_test.py
+++ b/tests/storage/devicelibs/edd_test.py
@@ -43,6 +43,14 @@ class EddTestCase(mock.TestCase):
         self.assertEqual(edd_dict[0x80].ata_device, 0)
         self.assertEqual(edd_dict[0x80].mbr_signature, "0x000ccb01")
 
+    def test_collect_edd_data_cciss(self):
+        from storage.devicelibs import edd
+        fs = EddTestFS(edd).sda_cciss()
+        edd_dict = edd.collect_edd_data()
+
+        self.assertEqual(edd_dict[0x80].pci_dev, None)
+        self.assertEqual(edd_dict[0x80].channel, None)
+
     def test_edd_entry_str(self):
         from storage.devicelibs import edd
         fs = EddTestFS(edd).sda_vda()
@@ -132,6 +140,15 @@ class EddTestFS(object):
         map(self.fs.os_remove, entries)
         return self.fs
 
+    def sda_cciss(self):
+        self.fs["/sys/firmware/edd/int13_dev80"] = self.fs.Dir()
+        self.fs["/sys/firmware/edd/int13_dev80/host_bus"] = "PCIX	05:00.0  channel: 0\n"
+        self.fs["/sys/firmware/edd/int13_dev80/interface"] = "RAID    	identity_tag: 0\n"
+        self.fs["/sys/firmware/edd/int13_dev80/mbr_signature"] = "0x000ccb01"
+        self.fs["/sys/firmware/edd/int13_dev80/sectors"] = "2097152\n"
+
+        return self.fs
+
     def vda_vdb(self):
         self.fs["/sys/firmware/edd/int13_dev80"] = self.fs.Dir()
         self.fs["/sys/firmware/edd/int13_dev80/host_bus"] = "PCI 	00:05.0  channel: 0\n"
-- 
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux