[anaconda:rhel7/master 2/2] Verify that designated label can be set (#1038590)

Vratislav Podzimek vpodzime at redhat.com
Fri Jan 10 06:59:20 UTC 2014


On Thu, 2014-01-09 at 13:57 -0500, mulhern wrote:
> Resolves: rhbz#1038590
> 
> Once the user has pressed accept verify that the label they have designated,
> if it is changed from the previous label, can actually be set.
> 
> Display an informative message and reset values if not.
> 
> One variable name was changed in the process and had to be substituted in
> a couple of places.
> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  pyanaconda/ui/gui/spokes/custom.py | 53 +++++++++++++++++++++++++++++++++-----
>  1 file changed, 47 insertions(+), 6 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index 74611d3..699f78b 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -109,6 +109,10 @@ unrecoverable_error_msg = N_("Storage configuration reset due to unrecoverable "
>  device_configuration_error_msg = N_("Device reconfiguration failed. Click for "
>                                      "details.")
>  
> +label_format_invalid_msg = N_("Unacceptable label format for filesystem.")
> +label_application_unavailable_msg = N_("Can not set label on filesystem.")
> +label_resetting_forbidden_msg = N_("Can not relabel already existing filesystem.")
> +
>  empty_mountpoint_msg = N_("Please enter a valid mountpoint.")
>  invalid_mountpoint_msg = N_("That mount point is invalid. Try something else?")
>  mountpoint_in_use_msg = N_("That mount point is already in use. Try something else?")
> @@ -123,6 +127,18 @@ container_type_names = {DEVICE_TYPE_LVM: lvm_container_name,
>                          DEVICE_TYPE_LVM_THINP: lvm_container_name,
>                          DEVICE_TYPE_BTRFS: btrfs_container_name}
>  
> +LABEL_OK = 0
> +LABEL_FORMAT_INVALID = 1
> +LABEL_APPLICATION_UNAVAILABLE = 2
> +LABEL_RESETTING_FORBIDDEN = 3
> +
> +label_validation_msgs = {
> +    LABEL_OK: "",
> +    LABEL_FORMAT_INVALID: label_format_invalid_msg,
> +    LABEL_APPLICATION_UNAVAILABLE: label_application_unavailable_msg,
> +    LABEL_RESETTING_FORBIDDEN: label_resetting_forbidden_msg}
> +
> +
>  MOUNTPOINT_OK = 0
>  MOUNTPOINT_INVALID = 1
>  MOUNTPOINT_IN_USE = 2
> @@ -198,6 +214,22 @@ def populate_mountpoint_store(store, used_mountpoints):
>          if path not in used_mountpoints:
>              store.append([path])
>  
> +def validate_label(label, fmt):
> +    """Returns a code indicating either that the given label can be set for
> +       this filesystem or the reason why it can not.
> +
> +       :param str label: The label
> +       :param DeviceFormat fmt: The device format to label
> +
> +    """
> +    if fmt.exists:
> +        return LABEL_RESETTING_FORBIDDEN
Is this always the case? I mean, does blivet support changing labels on
existing filesystems or not? We forbid it in the UI anyway, right?

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list