[blivet:master 7/7] Remove always succeeding check from udev_device_get_uuid() (#1070095)

mulhern amulhern at redhat.com
Tue Jun 24 17:04:28 UTC 2014


Related: rhbz#1070095

This function is always called before mdexamine is called for the device.
This means that MD_UUID will never be set, and so the condition, if checked,
will always succeed. Note that the regular expression in the condition
was used to address the issue of oddly formatted UUIDs from mdadm, now
addressed in a previous patch.

Expect that the previous patches will ensure that the uuid of the device is
reset correctly if the device is a member of an md array.

An alternative to some of the previous patches is to cause udev_get_device()
to invoke mdexamine, either unconditionally, or if ID_FS_TYPE indicates
that the device is an mdraid member. This would allow avoiding invoking
mdexamine anywhere else. One obvious drawback is that we would wish to be
consistent and do something similar for, e.g., lvm info, but that data
has been buttressed about with a lot of cacheing, because it is expensive to
get, and mdexamine probably suffers from a similar expensiveness.
Meanwhile, udev_get_device() is called whenever udev_get_block_device() is
called, which is whenever, udev_get_block_devices() is called which is
really quite frequently.

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

diff --git a/blivet/udev.py b/blivet/udev.py
index 126fbf9..343a8bc 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -207,12 +207,7 @@ def udev_device_get_format(udev_info):
 
 def udev_device_get_uuid(udev_info):
     """ Get the UUID from the device's format as reported by udev. """
-    md_uuid = udev_info.get("MD_UUID", '')
-    uuid = udev_info.get("ID_FS_UUID", '')
-    # we don't want to return the array's uuid as a member's uuid
-    if len(uuid) > 0 and \
-            re.sub(r'\W', '', md_uuid) != re.sub(r'\W', '', uuid):
-        return udev_info.get("ID_FS_UUID")
+    return udev_info.get("ID_FS_UUID")
 
 def udev_device_get_label(udev_info):
     """ Get the label from the device's format as reported by udev. """
-- 
1.9.3



More information about the anaconda-patches mailing list