Re: [PATCH f17-branch] Fix suggestDeviceName to correctly avoid in-use lv names. (#812528)

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

 



On Mon, May 07, 2012 at 11:04:31AM -0500, David Lehman wrote:
> There are two things the method was doing wrong:
>  1. not avoiding the names of lvs in the dialog's temporary vg
>  2. not using the full device name when checking numbered lv names
>     (lv device names are of the form "%s-%s" % (vgname, lvname))
> 
> There is another change here as well: if no distinguishing info is
> passed in (eg: mountpoint, swap), default to numbered names from
> the start. For the first three lvs you create, instead of lv, lv00,
> lv01 you'll get lv00, lv01, lv02. Consistency.
> ---
>  pyanaconda/storage/__init__.py |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
> index 89dfc67..8f46af8 100644
> --- a/pyanaconda/storage/__init__.py
> +++ b/pyanaconda/storage/__init__.py
> @@ -1109,10 +1109,16 @@ class Storage(object):
>              full += name
>              return full
>  
> -        if full_name(name, parent) in names:
> +        # also include names of any lvs in the parent for the case of the
> +        # temporary vg in the lvm dialogs, which can contain lvs that are
> +        # not yet in the devicetree and therefore not in self.names
> +        if hasattr(parent, "lvs"):
> +            names.extend([full_name(d.lvname, parent) for d in parent.lvs])
> +
> +        if full_name(name, parent) in names or not body:
>              for i in range(100):
>                  name = "%s%02d" % (template, i)
> -                if name not in names:
> +                if full_name(name, parent) not in names:
>                      break
>                  else:
>                      name = ""
> -- 
> 1.7.6

Ack

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)

Attachment: pgpfzKGAO3ZNV.pgp
Description: PGP signature

_______________________________________________
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