diff --git a/anaconda/pyanaconda/install.py b/anaconda/pyanaconda/install.py index a11b6b4..324e136 100644 --- a/anaconda/pyanaconda/install.py +++ b/anaconda/pyanaconda/install.py @@ -211,6 +211,17 @@ def doInstall(storage, payload, ksdata, instClass): wait_for_entropy=entropy_wait_clbk) turn_on_filesystems(storage, mount_only=flags.flags.dirInstall, callbacks=callbacks_reg) + + # For autopart, actual partition related objects (especially + # blivet.format.FS objects) are created by the above call. And autopart + # does not provide any way to specify default mount options (unlike manual + # partitioning). Because of this, patch it now to add 'discard' option. + if storage.root_device.format.options and \ + 'discard' not in storage.root_device.format.options: + storage.root_device.format.options += ',discard' + else: + storage.root_device.format.options = 'defaults,discard' + payload.writeStorageEarly() # Run %pre-install scripts with the filesystem mounted and no packages diff --git a/anaconda/pyanaconda/kickstart.py b/anaconda/pyanaconda/kickstart.py index c0db1b6..5cd86d5 100644 --- a/anaconda/pyanaconda/kickstart.py +++ b/anaconda/pyanaconda/kickstart.py @@ -885,6 +885,10 @@ class LogVolData(commands.logvol.F23_LogVolData): self.mountpoint = "" ty = None + if self.mountpoint.startswith('/') and not self.fsopts: + # enable discard for normal filesystems in dom0 + self.fsopts = "defaults,discard" + # Sanity check mountpoint if self.mountpoint != "" and self.mountpoint[0] != '/': raise KickstartParseError(formatErrorMsg(self.lineno, @@ -1245,6 +1249,10 @@ class PartitionData(commands.partition.F23_PartData): else: ty = storage.default_fstype + if self.mountpoint.startswith('/') and not self.fsopts: + # enable discard for normal filesystems in dom0 + self.fsopts = "defaults,discard" + if not size and self.size: try: size = Size("%d MiB" % self.size) @@ -1490,6 +1498,10 @@ class RaidData(commands.raid.F25_RaidData): else: ty = storage.default_fstype + if self.mountpoint.startswith('/') and not self.fsopts: + # enable discard for normal filesystems in dom0 + self.fsopts = "defaults,discard" + # Sanity check mountpoint if self.mountpoint != "" and self.mountpoint[0] != '/': raise KickstartParseError(formatErrorMsg(self.lineno,