Guard better against RaidChooser's selected_level being None #440
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This happens more often since blivet dropped linear from mdraid in storaged-project/blivet#1236 . It was the only RAID level supported for mdraid that had min_members of 1. When you add the first member for a new mdraid set, of course, there is only one member.
RaidChooser's update method checks the
min_members
on each level and only adds it to the liststore of available levels if we currently have at least that many members. So, before that blivet change, when there was only one member, "linear" was the only level in the liststore, and was necessarily the selected_level. Now linear is gone, when there is only one member of an mdraid set, there are no levels in the liststore, which means selected_level winds up being None.There are three places I can see in add_dialog.py which don't guard against selected_level being None. This fixes each of them.