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

Re: [rhel6-branch 3/4] mpath: use both 'multipath -d' and 'multipath -ll' to get the topology.



On 01/03/2011 08:48 PM, Chris Lumens wrote:
diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py
index 4909314..0d0efde 100644
--- a/storage/devicelibs/mpath.py
+++ b/storage/devicelibs/mpath.py
@@ -8,32 +8,44 @@ import logging
  log = logging.getLogger("storage")

  def parseMultipathOutput(output):
-    # this function parses output from "multipath -d", so we can use its
-    # logic for our topology.
-    # The input looks like:
-    # create: mpathc (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: mpathb (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
-    # create: mpatha (36001438005deb4710000500000270000) dm-0 HP,HSV400
-    # size=20G features='0' hwhandler='0' wp=rw
-    # |-+- policy='round-robin 0' prio=-1 status=active
-    # | |- 7:0:0:1 sda 8:0  active undef running
-    # | `- 7:0:1:1 sdb 8:16 active undef running
-    # `-+- policy='round-robin 0' prio=-1 status=enabled
-    #   |- 7:0:2:1 sdc 8:32 active undef running
-    #   `- 7:0:3:1 sdd 8:48 active undef running
-    #
-    # (In anaconda, the first one there won't be included because we blacklist
-    # "ATA" as a vendor.)
-    #
-    # It returns a structure like:
-    # [ {'mpatha':['sdb','sdc']}, ... ]
+    """
+    Parse output from "multipath -d" or "multipath -ll" and form a topology.
+
+    Returns a dictionary:
+    {'mpatha':['sdb','sdc'], 'mpathb': ['sdd', 'sde'], ... }
+
+    The 'multipath -d' output looks like:
+    create: mpathc (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: mpathb (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
+    create: mpatha (36001438005deb4710000500000270000) dm-0 HP,HSV400
+    size=20G features='0' hwhandler='0' wp=rw
+    |-+- policy='round-robin 0' prio=-1 status=active
+    | |- 7:0:0:1 sda 8:0  active undef running
+    | `- 7:0:1:1 sdb 8:16 active undef running
+    `-+- policy='round-robin 0' prio=-1 status=enabled
+    |- 7:0:2:1 sdc 8:32 active undef running
+    `- 7:0:3:1 sdd 8:48 active undef running
+
+    (In anaconda, the first one there won't be included because we blacklist
+    "ATA" as a vendor.)
+
+    The 'multipath -ll' output looks like (notice the missing 'create' before
+    'mpatha'):
+
+    mpatha (3600a0b800067fcc9000001694b557dd1) dm-0 IBM,1726-4xx  FAStT
+    size=360G features='0' hwhandler='1 rdac' wp=rw
+    `-+- policy='round-robin 0' prio=3 status=active
+      |- 2:0:0:0 sda 8:0  active ready running
+      `- 3:0:0:0 sdb 8:16 active ready running
+
+    """

Incidentally, I'm not really a fan of the blobs that change from
comments to docstrings, as I don't see that we are big users of
docstrings overall and it just inflates the patch size.

- Chris

Yeah, but I am sortof feeling like I've taken over the ownership of this file so I want it to look nice (i.e. rest of the storage code). It's the same problem like the tabs vs spaces or trailing whitespace. Not needed but while at it.. (I changed the docstring too).

Ales


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