[blivet:master] Only log a warning about labeling if something is actually wrong.

mulhern amulhern at redhat.com
Wed Mar 5 16:15:50 UTC 2014


If do_labeling is False, then we are not choosing to set a label during
filesystem creation. Probably we are deferring setting a label until
after the filesystem has been created.
If self.label is None then we are accepting the filesystem default label,
and not setting any label.

So, we only log a warning if setting a label is what ought to happen but we
don't want to risk it because it looks like the label format is not accepted
by this filesystem and that therefore, specifying the label arguments may cause
failure at filesystem creation.

Note: Some filesystem creation apps will truncate a label that is just too
long but others will fail instead. We do not want to distinguish
among filesystems based on this behavior.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/fs.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 2e2faeb..52abef5 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -353,10 +353,13 @@ class FS(DeviceFormat):
         argv.extend(self.defaultFormatOptions)
         if self._fsProfileSpecifier and self.fsprofile:
             argv.extend([self._fsProfileSpecifier, self.fsprofile])
-        if do_labeling and self.label is not None and self.labelFormatOK(self.label):
-            argv.extend(self._labelfs.labelingArgs(self.label))
-        else:
-            log.warning("Could not create label (%s) on filesystem %s", self.label, self.type)
+
+        if do_labeling and self.label is not None:
+            if self.labelFormatOK(self.label):
+                argv.extend(self._labelfs.labelingArgs(self.label))
+            else:
+                log.warning("Choosing not to apply label (%s) during creation of filesystem %s. Label format is unacceptable for this filesystem.", self.label, self.type)
+
         argv.append(self.device)
         return argv
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list