FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 11-10-2009, 11:48 AM
Martin Sivak
 
Default When creating a new md array check we have enough members (#533027)

Ack.

----- "Hans de Goede" <hdegoede@redhat.com> wrote:

> Make MDRaidArrayDevice.__init__ raise a value exception when creating
> a new (so non existing) raid set and there are not enough members for
> the requested raid level.
>
> And catch this value exception in the GUI raid dialog and kickstart
> raid
> commands.
> ---
> iw/raid_dialog_gui.py | 7 ++++++-
> kickstart.py | 5 ++++-
> storage/devices.py | 6 ++++++
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
> index e2ffe9a..8431e71 100644
> --- a/iw/raid_dialog_gui.py
> +++ b/iw/raid_dialog_gui.py
> @@ -201,12 +201,17 @@ class RaidEditor:
> format = fmt_class(mountpoint=mountpoint)
> members = len(raidmembers) - spares
>
> - request = self.storage.newMDArray(minor=raidminor,
> + try:
> + request =
> self.storage.newMDArray(minor=raidminor,
> level=raidlevel,
> format=format,
>
> parents=raidmembers,
>
> totalDevices=len(raidmembers),
>
> memberDevices=members)
> + except ValueError, e:
> + self.intf.messageWindow(_("Error"), str(e),
> + custom_icon="error")
> + continue
>
> # we must destroy luks leaf before original raid
> request
> if self.origrequest.format.type == "luks":
> diff --git a/kickstart.py b/kickstart.py
> index 147431b..aca5319 100644
> --- a/kickstart.py
> +++ b/kickstart.py
> @@ -877,7 +877,10 @@ class Raid(commands.raid.F12_Raid):
> except KeyError:
> pass
>
> - request = storage.newMDArray(**kwargs)
> + try:
> + request = storage.newMDArray(**kwargs)
> + except ValueError, e:
> + raise KickstartValueError,
> formatErrorMsg(self.lineno, msg=str(e))
>
> # FIXME: no way to specify an fsprofile right now
> # if pd.fsprofile:
> diff --git a/storage/devices.py b/storage/devices.py
> index 7b4b314..5049765 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -2197,6 +2197,12 @@ class MDRaidArrayDevice(StorageDevice):
> elif level is not None:
> self.level = mdraid.raidLevel(level)
>
> + # For new arrays check if we have enough members
> + if (not exists and parents and
> + len(parents) <
> mdraid.get_raid_min_members(self.level)):
> + raise ValueError, _("A RAID%d set requires atleast %d
> members") % (
> + self.level,
> mdraid.get_raid_min_members(self.level))
> +
> self.uuid = uuid
> self._totalDevices = numeric_type(totalDevices)
> self._memberDevices = numeric_type(memberDevices)
> --
> 1.6.5.2
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




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

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org