[blivet:master 04/11] Add documentation to udev_device_get_md_*() methods.

mulhern amulhern at redhat.com
Thu Jul 3 15:19:43 UTC 2014


The inline comments indicate the likely origin of the value.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/udev.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/blivet/udev.py b/blivet/udev.py
index 8b8c04a..bc4e21f 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -376,18 +376,62 @@ def udev_device_get_minor(info):
     return int(info["MINOR"])
 
 def udev_device_get_md_level(info):
+    """ Returns the RAID level of the array of which this device is a member.
+
+        :param dict info: dictionary of name-value pairs as strings
+        :returns: the RAID level of this device's md array
+        :rtype: str or NoneType
+    """
+    # Value for MD_LEVEL known to be obtained from:
+    #  * pyudev/libudev
+    #  * mdraid/mdadm (all numeric metadata versions and container default)
     return info.get("MD_LEVEL")
 
 def udev_device_get_md_devices(info):
+    """ Returns the number of devices in this devices's array.
+
+        :param dict info: dictionary of name-value pairs as strings
+        :returns: the number of devices belonging to this device's md array
+        :rtype: int
+        :raises: KeyError, ValueError
+    """
+    # Value for MD_DEVICES known to be obtained from:
+    #  * pyudev/libudev
+    #  * mdraid/mdadm (all numeric metadata versions and container default)
     return int(info["MD_DEVICES"])
 
 def udev_device_get_md_uuid(info):
+    """ Returns the uuid of the array of which this device is a member.
+
+        :param dict info: dictionary of name-value pairs as strings
+        :returns: the UUID of this device's md array
+        :rtype: str
+        :raises: KeyError
+    """
+    # Value for MD_UUID known to be obtained from:
+    #  * pyudev/libudev
+    #  * mdraid/mdadm (all numeric metadata versions and container default)
     return info["MD_UUID"]
 
 def udev_device_get_md_container(info):
+    """
+        :param dict info: dictionary of name-value pairs as strings
+        :rtype: str or NoneType
+    """
+    # Value for MD_CONTAINER known to be obtained from:
+    #  * None
     return info.get("MD_CONTAINER")
 
 def udev_device_get_md_name(info):
+    """ Returns the name of the array of which this device is a member.
+
+        :param dict info: dictionary of name-value pairs as strings
+        :returns: the name of this device's md array
+        :rtype: str or NoneType
+    """
+    # Value for MD_DEVNAME known to be obtained from:
+    #  * pyudev/libudev
+    #  * No known metadata versions for mdraid/mdadm
     return info.get("MD_DEVNAME")
 
 def udev_device_get_vg_name(info):
-- 
1.9.3



More information about the anaconda-patches mailing list