[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 1/1] Make sure we turn on swap flag. (#503457)



---
 storage/devices.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index b5e32af..2a9578d 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1130,6 +1130,15 @@ class PartitionDevice(StorageDevice):
         log_method_call(self, self.name)
         StorageDevice._setFormat(self, format)
 
+        if format.type == "swap":
+            if self.flagAvailable(parted.PARTITION_SWAP):
+                self.setFlag(parted.PARTITION_SWAP)
+            else:
+                # Swap will still work if we fail.
+                log.error("Failed to activate swap flag on %s" % self.name)
+        else:
+            self.unsetFlag(parted.PARTITION_SWAP)
+
     def _setBootable(self, bootable):
         """ Set the bootable flag for this partition. """
         if self.partedPartition:
-- 
1.6.0.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]