[PATCH 3/3] Tell blivet which swaps should appear in the fstab (#1011391)

Vratislav Podzimek vpodzime at redhat.com
Tue Oct 8 09:22:28 UTC 2013


Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/kickstart.py            | 13 +++++++++++++
 pyanaconda/ui/gui/spokes/custom.py |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 12797a6..3eb81ae 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -353,6 +353,9 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
 
             if not device:
                 raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent BTRFS volume %s in btrfs command" % self.name))
+
+            if ty == "swap":
+                storage.addFstabSwap(device)
         else:
             # If a previous device has claimed this mount point, delete the
             # old one.
@@ -371,6 +374,8 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
                                        parents=members)
 
             storage.createDevice(request)
+            if ty == "swap":
+                storage.addFstabSwap(request)
 
 
 class Realm(commands.realm.F19_Realm):
@@ -756,6 +761,8 @@ class LogVolData(commands.logvol.F20_LogVolData):
                             msg="Invalid target size (%d) for device %s" % (self.size, device.name)))
 
             devicetree.registerAction(ActionCreateFormat(device, fmt))
+            if ty == "swap":
+                storage.addFstabSwap(device)
         else:
             # If a previous device has claimed this mount point, delete the
             # old one.
@@ -789,6 +796,8 @@ class LogVolData(commands.logvol.F20_LogVolData):
                                     **pool_args)
 
             storage.createDevice(request)
+            if ty == "swap":
+                storage.addFstabSwap(request)
 
         if self.encrypted:
             if self.passphrase and not storage.encryptionPassphrase:
@@ -1026,6 +1035,8 @@ class PartitionData(commands.partition.F18_PartData):
                             msg="Invalid target size (%d) for device %s" % (self.size, device.name)))
 
             devicetree.registerAction(ActionCreateFormat(device, kwargs["format"]))
+            if ty == "swap":
+                storage.addFstabSwap(device)
         else:
             # If a previous device has claimed this mount point, delete the
             # old one.
@@ -1038,6 +1049,8 @@ class PartitionData(commands.partition.F18_PartData):
 
             request = storage.newPartition(**kwargs)
             storage.createDevice(request)
+            if ty == "swap":
+                storage.addFstabSwap(request)
 
         if self.encrypted:
             if self.passphrase and not storage.encryptionPassphrase:
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 16b73ba..7bbe158 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -666,6 +666,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         self.storage.devicetree.names = self.__storage.devicetree.names
         self.storage.roots = self.__storage.roots
 
+        new_swaps = (dev for dev in self.new_devices if dev.format.type == "swap")
+        self.storage.setFstabSwaps(new_swaps)
+
         # update the global passphrase
         self.data.autopart.passphrase = self.passphrase
 
-- 
1.7.11.7



More information about the anaconda-patches mailing list