Re: [PATCH] Create a getDeps and getTarget function for the block module.

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

 



On Tue, 2009-01-06 at 16:47 +0100, Joel Granados Moreno wrote:
> ---
>  __init__.py |   45 ++++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 42 insertions(+), 3 deletions(-)
> 

Looks good, except perhaps for the whitespace changes in the first two
hunks.

Dave

> diff --git a/__init__.py b/__init__.py
> index 943e127..0c94c2d 100644
> --- a/__init__.py
> +++ b/__init__.py
> @@ -60,7 +60,6 @@ def load(name):
>      _bd.load(name)
>      global _probesLoaded
>      _probesLoaded = True
> -    
>  
>  def getDevice(name):
>      name = name.split('/')[-1]
> @@ -165,11 +164,11 @@ def getRaidSets(*disks):
>              disks += list(disk)
>          else:
>              disks.append(disk)
> -        
> +
>      c = dmraid.context()
>      rsList = []
>      prefix = "/dev/mapper/"
> -    
> +
>      newdisks = []
>      import os as _os
>      for x in range(len(disks)):
> @@ -190,6 +189,46 @@ def getRaidSets(*disks):
>              rsList.append(set)
>      return rsList
>  
> +def getDmDeps(uuid = None, major = None, minor = None, name = None):
> +    """ Retrieve the deps for a specified map/device.
> +
> +    uuid and name are strings.  major and minor are converted to long before
> +    being compared.
> +
> +    Returns a set of deps for the device.
> +    Returns () when no deps are found for the specified device.
> +    Returns None when device was not found.
> +    """
> +    # If has dpes, return a set of maps, else return an empty set.
> +    for map in dm.maps():
> +        if (map.name and map.name == name) or \
> +                (map.uuid and map.uuid == uuid) or \
> +                (map.dev.minor and map.dev.minor == long(minor) and \
> +                 map.dev.major and map.dev.major == long(major)):
> +            return map.deps
> +    return None
> +
> +def getDmTarget(uuid = None, major = None, minor = None, name = None):
> +    """ Retrieve the target for a specified map/device.
> +
> +    uuid and name are strings.  major and minor are converted to long before
> +    being compared.
> +
> +    Returns a string.
> +    Returns None when device was not found.
> +
> +    Note: None is returned if map.table.type is None.
> +    """
> +    # Return None if we don't find the map.
> +    for map in dm.maps():
> +        if (map.name and map.name == name) or \
> +                (map.uuid and map.uuid == uuid) or \
> +                (map.dev.minor and map.dev.minor == long(minor) and \
> +                 map.dev.major and map.dev.major == long(major)):
> +            # might be worth validating tupe.
> +            return map.table.type
> +    return None
> +
>  __all__ = [ "dm", "dmraid", "BlockDev" ]
>  
>  #

_______________________________________________
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