Re: [PATCH 2/8] Changes for using mdadm for isw_raid_member

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

 



On Wed, 2009-04-08 at 15:07 +0200, Jacek Danecki wrote:
> New iswmd parameter for kernel cmdline

Instead of gunking things up with checking of command line args and
such, would something like the attached patch work?

> 
> diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
> index 784bb1c..1bdc7c5 100644
> --- a/storage/formats/__init__.py
> +++ b/storage/formats/__init__.py
> @@ -3,6 +3,9 @@
>  #
>  # Copyright (C) 2009  Red Hat, Inc.
>  #
> +# Copyright (C) 2009 Intel Corporation
> +# April 2009 - Changes for MD support for isw format
> +#
>  # This copyrighted material is made available to anyone wishing to use,
>  # modify, copy, or redistribute it subject to the terms and conditions of
>  # the GNU General Public License v.2, or (at your option) any later version.
> @@ -112,6 +115,9 @@ def collect_device_format_classes():
>                  log.debug("import of device format module '%s' failed" % mod_name)
>  
>  def get_device_format_class(fmt_type):
> +    from mdraid import MDRaidMember
> +    from dmraid import DMRaidMember
> +    from flags import flags
>      """ Return an appropriate format class based on fmt_type. """
>      if not device_formats:
>          collect_device_format_classes()
> @@ -122,6 +128,10 @@ def get_device_format_class(fmt_type):
>              if fmt_type and fmt_type == fmt_class._name:
>                  fmt = fmt_class
>                  break
> +            elif fmt_type == "isw_raid_member" and flags.cmdline.has_key("iswmd"):
> +                       log.debug("found MD cmdline parameter")
> +                       fmt = MDRaidMember
> +                       break
>              elif fmt_type in fmt_class._udevTypes:
>                  fmt = fmt_class
>                  break
> diff --git a/storage/udev.py b/storage/udev.py
> index 63cc3fd..b56599f 100644
> --- a/storage/udev.py
> +++ b/storage/udev.py
> @@ -3,6 +3,9 @@
>  #
>  # Copyright (C) 2009  Red Hat, Inc.
>  #
> +# Copyright (C) 2009 Intel Corporation
> +# April 2009 - Changes for MD support for isw format
> +#
>  # This copyrighted material is made available to anyone wishing to use,
>  # modify, copy, or redistribute it subject to the terms and conditions of
>  # the GNU General Public License v.2, or (at your option) any later version.
> @@ -308,6 +311,21 @@ def udev_device_is_dmraid(info):
>  
>      return False
>  
> +def udev_device_is_mdraid(info):
> +    from formats.mdraid import MDRaidMember
> +    from flags import flags
> +    if info.has_key("ID_FS_TYPE"):
> +        if flags.cmdline.has_key("iswmd"):
> +            log.debug("found MD cmdline parameter")
> +            if info["ID_FS_TYPE"] == "isw_raid_member":
> +                log.debug("use MD for isw")
> +                return True
> +        else:     
> +            if info["ID_FS_TYPE"] in MDRaidMember._udevTypes:
> +                return True
> +
> +    return False
> +
>  def udev_device_get_dmraid_partition_disk(info):
>      try:
>          p_index = info["DM_NAME"].rindex("p") 
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
index 4ebd41c..c1d6593 100644
--- a/storage/formats/dmraid.py
+++ b/storage/formats/dmraid.py
@@ -21,6 +21,7 @@
 #
 
 from iutil import log_method_call
+from flags import flags
 from ..errors import *
 from . import DeviceFormat, register_device_format
 
@@ -93,5 +95,9 @@ class DMRaidMember(DeviceFormat):
                         type=self.type, status=self.status)
         raise DMRaidMemberError("destruction of dmraid members is non-sense")
 
+
+if not flags.cmdline.has_key("iswmd"):
+    DMRaidMember._udevTypes.remove("isw_raid_member")
+
 register_device_format(DMRaidMember)
 
diff --git a/storage/formats/mdraid.py b/storage/formats/mdraid.py
index ec1a617..36bfa1c 100644
--- a/storage/formats/mdraid.py
+++ b/storage/formats/mdraid.py
@@ -23,6 +23,7 @@
 import os
 
 from iutil import log_method_call
+from flags import flags
 from parted import PARTITION_RAID
 from ..errors import *
 from ..devicelibs import mdraid
@@ -93,5 +94,8 @@ class MDRaidMember(DeviceFormat):
         return False
 
 
+if flags.cmdline.has_key("iswmd"):
+    MDRaidMember._udevTypes.append("isw_raid_member")
+
 register_device_format(MDRaidMember)
 
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux