Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Xubuntu Development (http://www.linux-archive.org/xubuntu-development/)
-   -   Fix suggestDeviceName to correctly avoid in-use lv names. (#812528) (http://www.linux-archive.org/xubuntu-development/663981-fix-suggestdevicename-correctly-avoid-use-lv-names-812528-a.html)

"Brian C. Lane" 05-07-2012 04:24 PM

Fix suggestDeviceName to correctly avoid in-use lv names. (#812528)
 
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)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 09:38 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.