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

Re: [PATCH 1/3] Move blockdev blacklisting to be a function



On Thu, 2009-03-19 at 14:07 -0400, Jeremy Katz wrote:
> ---
>  storage/udev.py |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)

On second thought, why would you leave behind the know-good sysfs path
and then recreate it in __is_blacklisted_blockdev when you could just
pass the sysfs path as the sole argument?

Dave

> 
> diff --git a/storage/udev.py b/storage/udev.py
> index a6d3190..e8e8246 100644
> --- a/storage/udev.py
> +++ b/storage/udev.py
> @@ -39,11 +39,18 @@ def udev_get_block_devices():
>              entries.append(entry)
>      return entries
>  
> +def __is_blacklisted_blockdev(dev_name):
> +    """Is this a blockdev we never want for an install?"""
> +    if dev_name.startswith("loop") or dev_name.startswith("ram"):
> +        return True
> +
> +    return False
> +
>  def enumerate_block_devices():
>      top_dir = "/sys/class/block"
>      devices = []
>      for dev_name in os.listdir(top_dir):
> -        if dev_name.startswith("loop") or dev_name.startswith("ram"):
> +        if __is_blacklisted_blockdev(dev_name):
>              continue
>          full_path = os.path.join(top_dir, dev_name)
>          link_ref = os.readlink(full_path)


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