While we have support for fsprofile, that is only supported by the various ext* filesystems. We have no way to support passing options for any of the other filesystems, including the default in RHEL.
Resolves: rhbz#1220898 --- blivet/formats/__init__.py | 23 +++++++++++++++++++---- blivet/formats/fs.py | 1 + blivet/tasks/fsmkfs.py | 4 +++- 3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py index b3e58fa..89976e6 100644 --- a/blivet/formats/__init__.py +++ b/blivet/formats/__init__.py @@ -187,19 +187,22 @@ class DeviceFormat(ObjectID): self.uuid = kwargs.get("uuid") self.exists = kwargs.get("exists", False) self.options = kwargs.get("options") + self._createOptions = kwargs.get("createOptions")
def __repr__(self): s = ("%(classname)s instance (%(id)s) object id %(object_id)d--\n" " type = %(type)s name = %(name)s status = %(status)s\n" " device = %(device)s uuid = %(uuid)s exists = %(exists)s\n" - " options = %(options)s supported = %(supported)s" + " options = %(options)s\n" + " createOptions = %(createOptions)s supported = %(supported)s" " formattable = %(format)s resizable = %(resize)s\n" % {"classname": self.__class__.__name__, "id": "%#x" % id(self), - "object_id": self.id, + "object_id": self.id, "createOptions": self.createOptions, "type": self.type, "name": self.name, "status": self.status, "device": self.device, "uuid": self.uuid, "exists": self.exists, "options": self.options, "supported": self.supported, - "format": self.formattable, "resize": self.resizable}) + "format": self.formattable, "resize": self.resizable, + "createOptions": self.createOptions}) return s
@property @@ -218,7 +221,7 @@ class DeviceFormat(ObjectID): d = {"type": self.type, "name": self.name, "device": self.device, "uuid": self.uuid, "exists": self.exists, "options": self.options, "supported": self.supported, - "resizable": self.resizable} + "resizable": self.resizable, "createOptions": self.createOptions} return d
def labeling(self): @@ -290,6 +293,18 @@ class DeviceFormat(ObjectID): doc="fstab entry option string" )
+ def _setCreateOptions(self, options): + self._createOptions = options + + def _getCreateOptions(self): + return self._createOptions + + createOptions = property( + lambda s: s._getCreateOptions(), + lambda s,v: s._setCreateOptions(v), + doc="options to be used when running mkfs" + } + def _deviceCheck(self, devspec): """ Verifies that device spec has a proper format.
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py index e2c5ef3..90cbca6 100644 --- a/blivet/formats/fs.py +++ b/blivet/formats/fs.py @@ -782,6 +782,7 @@ class FS(DeviceFormat): else: data.fsopts = ""
+ data.mkfsopts = self.createOptions or "" data.fsprofile = self.fsprofile or ""
class Ext2FS(FS): diff --git a/blivet/tasks/fsmkfs.py b/blivet/tasks/fsmkfs.py index 542e61d..15138ae 100644 --- a/blivet/tasks/fsmkfs.py +++ b/blivet/tasks/fsmkfs.py @@ -20,6 +20,7 @@ # Red Hat Author(s): Anne Mulhern amulhern@redhat.com
import abc +import shlex
from six import add_metaclass
@@ -90,7 +91,8 @@ class FSMkfs(task.BasicApplication, FSMkfsTask): raise FSError("options parameter must be a list.")
label_options = self._labelOptions if label else [] - return options + self.args + label_options + [self.fs.device] + create_options = shlex.split(self.fs.createOptions or "") + return options + self.args + label_options + create_options + [self.fs.device]
def _mkfsCommand(self, options, label): """Return the command to make the filesystem.
On Wed, 2015-07-01 at 14:45 -0400, Chris Lumens wrote:
While we have support for fsprofile, that is only supported by the various ext* filesystems. We have no way to support passing options for any of the other filesystems, including the default in RHEL.
Resolves: rhbz#1220898
blivet/formats/__init__.py | 23 +++++++++++++++++++---- blivet/formats/fs.py | 1 + blivet/tasks/fsmkfs.py | 4 +++- 3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py index b3e58fa..89976e6 100644 --- a/blivet/formats/__init__.py +++ b/blivet/formats/__init__.py @@ -187,19 +187,22 @@ class DeviceFormat(ObjectID): self.uuid = kwargs.get("uuid") self.exists = kwargs.get("exists", False) self.options = kwargs.get("options")
self._createOptions = kwargs.get("createOptions")
def __repr__(self): s = ("%(classname)s instance (%(id)s) object id %(object_id)d--\n" " type = %(type)s name = %(name)s status = %(status)s\n" " device = %(device)s uuid = %(uuid)s exists = %(exists)s\n"
" options = %(options)s supported = %(supported)s"
" options = %(options)s\n"
" createOptions = %(createOptions)s supported = %(supported)s" " formattable = %(format)s resizable = %(resize)s\n" % {"classname": self.__class__.__name__, "id": "%#x" % id(self),
"object_id": self.id,
"object_id": self.id, "createOptions": self.createOptions, "type": self.type, "name": self.name, "status": self.status, "device": self.device, "uuid": self.uuid, "exists": self.exists, "options": self.options, "supported": self.supported,
"format": self.formattable, "resize": self.resizable})
"format": self.formattable, "resize": self.resizable,
"createOptions": self.createOptions}) return s
@property
@@ -218,7 +221,7 @@ class DeviceFormat(ObjectID): d = {"type": self.type, "name": self.name, "device": self.device, "uuid": self.uuid, "exists": self.exists, "options": self.options, "supported": self.supported,
"resizable": self.resizable}
"resizable": self.resizable, "createOptions": self.createOptions} return d
def labeling(self):
@@ -290,6 +293,18 @@ class DeviceFormat(ObjectID): doc="fstab entry option string" )
- def _setCreateOptions(self, options):
self._createOptions = options
- def _getCreateOptions(self):
return self._createOptions
- createOptions = property(
lambda s: s._getCreateOptions(),
lambda s,v: s._setCreateOptions(v),
doc="options to be used when running mkfs"
- }
- def _deviceCheck(self, devspec): """ Verifies that device spec has a proper format.
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py index e2c5ef3..90cbca6 100644 --- a/blivet/formats/fs.py +++ b/blivet/formats/fs.py @@ -782,6 +782,7 @@ class FS(DeviceFormat): else: data.fsopts = ""
data.mkfsopts = self.createOptions or "" data.fsprofile = self.fsprofile or ""
class Ext2FS(FS): diff --git a/blivet/tasks/fsmkfs.py b/blivet/tasks/fsmkfs.py index 542e61d..15138ae 100644 --- a/blivet/tasks/fsmkfs.py +++ b/blivet/tasks/fsmkfs.py @@ -20,6 +20,7 @@ # Red Hat Author(s): Anne Mulhern amulhern@redhat.com
import abc +import shlex
from six import add_metaclass
@@ -90,7 +91,8 @@ class FSMkfs(task.BasicApplication, FSMkfsTask): raise FSError("options parameter must be a list.")
label_options = self._labelOptions if label else []
return options + self.args + label_options + [self.fs.device]
create_options = shlex.split(self.fs.createOptions or "")
return options + self.args + label_options + create_options + [self.fs.device]
def _mkfsCommand(self, options, label): """Return the command to make the filesystem.
Looks good to me.
anaconda-patches@lists.fedorahosted.org