Yes, it does have such a method.
Fixed in working copy.
- mulhern
----- Original Message -----
From: "David Lehman" <dlehman(a)redhat.com>
To: "anaconda patch review" <anaconda-patches(a)lists.fedorahosted.org>
Sent: Tuesday, November 26, 2013 1:48:17 PM
Subject: Re: [master 1/2] Use level objects instead of level integer codes.
On Tue, 2013-11-26 at 13:37 -0500, mulhern wrote:
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 <amulhern(a)redhat.com>
---
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 1950a5b..7e6829f 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -519,11 +519,11 @@ class ContainerDialog(GUIObject):
raid_level = selectedRaidLevel(self._raidLevelCombo)
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,
+ % {"level" : md_level.name,
The raid level class should have a __str__ method that prints the
canonical name, making the ".name" above unnecessary.
"min" : min_disks,
"count" : len(paths)})
self._error_label.set_text(self._error)
@@ -1247,11 +1247,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,
+ {"level": md_level.name,
Same here.
"min" : min_disks,
"count": len(self._device_disks)}
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches