[rhinstaller/anaconda/pulls/60 master] Enforce sane disk selections.
dwlehman
installerbot-noreply at redhat.com
Wed Apr 1 13:16:12 UTC 2015
> @@ -92,3 +92,33 @@ def applyDiskSelection(storage, data, use_names):
>
> data.ignoredisk.onlyuse = onlyuse
> data.clearpart.drives = use_names[:]
> +
> +def getRelatedDisks(storage, disk):
> + """ Return a list of disks related to disk by way of container devices. """
> + return set(d for dep in storage.deviceDeps(disk) for d in dep.disks)
> +
> +def checkDiskSelection(storage, all_disks, selected_disks):
> + """ Return a list of errors related to a proposed disk selection.
> +
> + :param :class:`blivet.Blivet` storage: storage data
> + :param all_disks: all known disks
> + :type all_disks: list of :class:`blivet.devices.StorageDevice`
> + :param selected_disks: proposed selected disks
> + :type selected_disks: list of :class:`blivet.devices.StorageDevice`
> + :returns: a list of error messages
> + :rtype: list of str
> + """
> + errors = []
> + for selected in all_disks:
> + if selected.name not in selected_disks:
> + continue
The docstring is wrong. selected_disks is a list of disk _names_. We could look them up by name, but I'm not sure that's any better than just passing the list in.
--
To view this pull request on github, visit https://github.com/rhinstaller/anaconda/pull/60#discussion_r27567372
More information about the anaconda-patches
mailing list