summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2010-01-14 23:17:42 -0500
committerPeter Jones <pjones@redhat.com>2010-01-20 16:55:30 -0500
commita7cd186fb14ecd1429799f06820e2e4f214d97be (patch)
tree64a5cb527e6532c97e8e006d557cbc8b797174ec /tests
parente841139cf9486aa1f1ca50c15e2086c323d5370e (diff)
downloadanaconda-a7cd186fb14ecd1429799f06820e2e4f214d97be.tar.gz
anaconda-a7cd186fb14ecd1429799f06820e2e4f214d97be.tar.xz
anaconda-a7cd186fb14ecd1429799f06820e2e4f214d97be.zip
Add a parser for 'multipath -d' output.
We need to find out about multipath topology from /sbin/multipath, which unfortunately needs some parsing - it's fairly easy, though.
Diffstat (limited to 'tests')
-rw-r--r--tests/storage/devicelibs/mpath.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/storage/devicelibs/mpath.py b/tests/storage/devicelibs/mpath.py
new file mode 100644
index 000000000..8210b0b3b
--- /dev/null
+++ b/tests/storage/devicelibs/mpath.py
@@ -0,0 +1,29 @@
+import baseclass
+import unittest
+import storage.devicelibs.mpath as mpath
+
+class MPathTestCase(baseclass.DevicelibsTestCase):
+ def testMPath(self):
+ ##
+ ## parseMultipathOutput
+ ##
+ output="""\
+create: mpathb (1ATA ST3120026AS 5M) undef ATA,ST3120026AS
+size=112G features='0' hwhandler='0' wp=undef
+`-+- policy='round-robin 0' prio=1 status=undef
+ `- 2:0:0:0 sda 8:0 undef ready running
+create: mpatha (36006016092d21800703762872c60db11) undef DGC,RAID 5
+size=10G features='1 queue_if_no_path' hwhandler='1 emc' wp=undef
+`-+- policy='round-robin 0' prio=2 status=undef
+ |- 6:0:0:0 sdb 8:16 undef ready running
+ `- 7:0:0:0 sdc 8:32 undef ready running
+"""
+ topology = mpath.parseMultipathOutput(output)
+ expected = {'mpatha':['sdb','sdc'], 'mpathb':['sda']}
+ self.assertEqual(topology, expected)
+
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(MPathTestCase)
+
+if __name__ == '__main__':
+ unittest.main()