[blivet:master 10/11] Add new method udev_device_get_md_device_uuid() method (#1070095)

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


Related: rhbz#1070095

Note that the value is only obtained from mdadm and only if recent
metadata version is used.

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

diff --git a/blivet/udev.py b/blivet/udev.py
index d3a8259..8552f43 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -446,6 +446,18 @@ def udev_device_get_md_metadata(info):
     #  * mdraid/mdadm (not version numbers < 1)
     return info.get("MD_METADATA")
 
+def udev_device_get_md_device_uuid(info):
+    """ Returns the uuid of a device which is a member of an md array.
+
+        :param dict info: dictionary of name-value pairs as strings
+        :returns: the uuid of this device (which is a member of an md array)
+        :rtype: str or NoneType
+    """
+    # Value for MD_UUID known to be obtained from:
+    #  * pyudev/libudev
+    #  * mdraid/mdadm (only 1.x metadata versions)
+    return info.get('MD_DEV_UUID')
+
 def udev_device_get_vg_name(info):
     return info['LVM2_VG_NAME']
 
-- 
1.9.3



More information about the anaconda-patches mailing list