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

Re: [PATCH 2/4] Add getDasdPorts() to storage/dasd.py.



Maybe we don't even need this function any more. I'll write the reasons
in a reply to patch 3/4.

It looks good though.

On 02/19/2010 09:38 PM, David Cantrell wrote:
> Reimplement the old isys.getDasdPorts() function in Python.
> ---
>  storage/dasd.py |   17 +++++++++++++++++
>  1 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/storage/dasd.py b/storage/dasd.py
> index 591dde0..2052843 100644
> --- a/storage/dasd.py
> +++ b/storage/dasd.py
> @@ -33,6 +33,23 @@ import gettext
>  _ = lambda x: gettext.ldgettext("anaconda", x)
>  P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)
> 
> +def getDasdPorts():
> +    """ Return comma delimited string of valid DASD ports. """
> +    ports = []
> +
> +    f = open("/proc/dasd/devices", "r")
> +    lines = map(lambda x: x.strip(), f.readlines())
> +    f.close()
> +
> +    for line in lines:
> +        if "unknown" in line:
> +            continue
> +
> +        if "(FBA )" in line or "(ECKD)" in line:
> +            ports.append(line.split('(')[0])
> +
> +    return ','.join(ports)
> +
>  class DASD:
>      """ Controlling class for DASD interaction before the storage code in
>          anaconda has initialized.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



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