From 6c874223c864bc1cb31a0cd3ee0f06dfe1c873df Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 26 Nov 2013 08:25:04 -0500 Subject: [PATCH 05/28] Use level objects instead of level integer codes. Get min_members through the raid object obtained by mdraid.getRaidLevel rather than passing the raid number to an mdraid procedure. Previously, if the raid_level had been "container" an MDRaidLevel exception would have been thrown. Now, there is no exception, and the corresponding min_members field is 1. In the current interface, the raid level is always one of the standard RAID levels, so this can never happen. Also, previously the error message would always contain the raid_level value to describe the raid_level. Now it user the raid level's canonical name instead. However, that seems to be the same as the name that is constructed in the existing implementation, so expect no observable difference. Signed-off-by: mulhern (cherry picked from commit 1d3dab5c44c5a045ee8e73f4617cb982e7eb36c9) --- pyanaconda/ui/gui/spokes/custom.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index de2e13d..eaaa420 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -532,11 +532,11 @@ class ContainerDialog(GUIObject): raid_level = self._get_raid_level() if raid_level: - md_level = mdraid.raidLevel(raid_level) - min_disks = mdraid.get_raid_min_members(md_level) + md_level = mdraid.getRaidLevel(raid_level) + min_disks = md_level.min_members if len(paths) < min_disks: self._error = (_(raid_level_not_enough_disks_msg) - % {"level": raid_level, "min": min_disks, "count": len(paths)}) + % {"level": md_level, "min": min_disks, "count": len(paths)}) self.builder.get_object("containerErrorLabel").set_text(self._error) self.window.show_all() return @@ -1275,11 +1275,11 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): error = _("Devices of type %s require a valid RAID level selection.") % DEVICE_TEXT_MD if not error and raid_level not in (None, "single"): - md_level = mdraid.raidLevel(raid_level) - min_disks = mdraid.get_raid_min_members(md_level) + md_level = mdraid.getRaidLevel(raid_level) + min_disks = md_level.min_members if len(self._device_disks) < min_disks: error = (_(raid_level_not_enough_disks_msg) - % {"level": raid_level, "min": min_disks, "count": len(self._device_disks)}) + % {"level": md_level, "min": min_disks, "count": len(self._device_disks)}) if error: self.set_warning(error) -- 1.9.3