diff --git a/pyanaconda/installation.py b/pyanaconda/installation.py index 00aff85dc11..70cc19a8a2b 100644 --- a/pyanaconda/installation.py +++ b/pyanaconda/installation.py @@ -280,6 +280,15 @@ def wait_for_all_treads(): task_args=(storage,), task_kwargs={"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' + early_storage.append(Task("Write early storage", payload.writeStorageEarly)) installation_queue.append(early_storage) diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 175ed6d1302..85eaec799ec 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -1102,6 +1102,10 @@ def execute(self, storage, ksdata, instClass): 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(lineno=self.lineno, @@ -1571,6 +1575,10 @@ def execute(self, storage, ksdata, instClass): 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) @@ -1834,6 +1842,10 @@ def execute(self, storage, ksdata, instClass): 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(lineno=self.lineno,