[PATCH 2/3] Add handling for incomplete lvm/md devices.

Chris Lumens clumens at redhat.com
Tue Dec 18 21:31:00 UTC 2012


> @@ -2122,22 +2127,40 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
>  
>              self._current_selector.set_chosen(False)
>  
> +        no_edit = False
>          if selector._device.format.type == "luks" and \
>             selector._device.format.exists:
>              self._partitionsNotebook.set_current_page(NOTEBOOK_LUKS_PAGE)
>              selectedDeviceLabel = self.builder.get_object("encryptedDeviceLabel")
>              selectedDeviceDescLabel = self.builder.get_object("encryptedDeviceDescriptionLabel")
> -            selectedDeviceLabel.set_text(selector.props.name)
> -            selectedDeviceDescLabel.set_text(self._description(selector.props.name))
> -            selector.set_chosen(True)
> -            self._current_selector = selector
> -            self._configButton.set_sensitive(False)
> -            self._removeButton.set_sensitive(True)
> -            return
> +            no_edit = True
> +        elif not getattr(selector._device, "complete", True):
> +            self._partitionsNotebook.set_current_page(NOTEBOOK_INCOMPLETE_PAGE)
> +            selectedDeviceLabel = self.builder.get_object("incompleteDeviceLabel")
> +            selectedDeviceDescLabel = self.builder.get_object("incompleteDeviceDescriptionLabel")
> +            optionsLabel = self.builder.get_object("incompleteDeviceOptionsLabel")
> +
> +            if selector._device.type == "mdarray":
> +                total = selector._device.memberDevices
> +                missing = total - len(selector._device.parents)
> +                txt = _("This Software RAID array is missing %d of %d member "
> +                        "partitions. You can remove it or select a different "
> +                        "device.") % (missing, total)
> +            else:
> +                total = selector._device.pvCount
> +                missing = total - len(selector._device.parents)
> +                txt = _("This LVM Volume Group is missing %d of %d physical "
> +                        "volumes. You can remove it or select a different "
> +                        "device.") % (missing, total)

For these kinds of strings, it's easier to translate if you use the dict
form of substitution.  See distributionText in product.py for an
example.

- Chris


More information about the anaconda-patches mailing list