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

Re: [PATCH] Be more careful when selecting a vg name.



> diff --git a/storage/devicelibs/lvm.py b/storage/devicelibs/lvm.py
> index bdb732a..e5b0bd9 100644
> --- a/storage/devicelibs/lvm.py
> +++ b/storage/devicelibs/lvm.py
> @@ -236,6 +236,20 @@ def vginfo(vg_name):
>       d['pe_count'],d['pe_free'],d['pv_count']) = info
>      return d
>  
> +def vgdetectednames():
> +    """ Will run vgs and return all the detected names.
> +
> +    There is a change that there are vgnames that are recognized by lvm.
> +    It is important to know what these vgs are.
> +    """
> +    retval = []
> +    names = iutil.execWithCapture("lvm",
> +            ["vgs", "--noheadings", "-o", "vg_name"],
> +            stderr="/dev/tty5")
> +    for name in names.strip("\n").split("\n"):
> +        retval.append(name.strip())
> +    return retval
> +

I like, but how are you going to split on a newline if you've already
stripped it off?

- Chris


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