[blivet:master 09/11] Canonicalize mdadm generated UUIDS (#1070095)
Vratislav Podzimek
vpodzime at redhat.com
Fri Jul 4 07:04:35 UTC 2014
On Thu, 2014-07-03 at 11:19 -0400, mulhern wrote:
> Related: rhbz#1070095
>
> Examined alternatives are:
> 1) To make use of the uuid.UUID class to store uuids. The difficulty
> with this idea is that some things that are labeled uuids are not proper
> uuids at all.
> 2) To make the udev_info dict more object oriented, and have it sanitize
> uuids when they are added. A lot of work for very limited benefit.
> 3) To canonicalize uuids everytime they are extracted from the info.
> Brittle, since you can't stop code from accessing the entries directly,
> and annoyingly inefficient.
>
> This alternative is pretty simple, and to a certain extent it's a
> workaround for a bug in mdadm, so it wins.
>
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> blivet/devicelibs/mdraid.py | 9 +++++++++
> tests/devicelibs_test/mdraid_test.py | 6 ++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py
> index f46571a..31e5b80 100644
> --- a/blivet/devicelibs/mdraid.py
> +++ b/blivet/devicelibs/mdraid.py
> @@ -242,6 +242,15 @@ def mdexamine(device):
> if name == "metadata":
> info["MD_METADATA"] = value
>
> + # mdadm's UUIDs are actual 128 bit uuids, but it formats them strangely.
> + # This converts the uuids to canonical form.
> + # Example:
> + # mdadm UUID: '3386ff85:f5012621:4a435f06:1eb47236'
> + # canonical UUID: '3386ff85-f501-2621-4a43-5f061eb47236'
> + import uuid
Any reason for the local import? If yes, it should either be fixed or
documented.
--
Vratislav Podzimek
Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list