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

Anne Mulhern amulhern at redhat.com
Fri Jan 10 13:37:50 UTC 2014





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Friday, January 10, 2014 1:59:20 AM
> Subject: Re: [anaconda:rhel7/master 2/2] Verify that designated label can be	set (#1038590)
> 
> 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?
> 

The answer is yes for DeviceFormats that extend FS (regular filesystems) but no for SwapSpace...you'ld have to just recreate the whole swap space and currently blivet considers that an error.

I think the reason that it is not allowed in the GUI is that there is no blivet action that you can register for relabeling.

- mulhern

> --
> Vratislav Podzimek
> 
> Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 


More information about the anaconda-patches mailing list