[rhel7-branch 2/2] Use the LUKS device for encrypted swap on RAID
by dashea
From: David Shea <dshea(a)redhat.com>
This fixes the fstab entry for RAID+LUKS+swap in the same way that it is
handled for LVM.
Related: rhbz#1302747
---
pyanaconda/kickstart.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index fe7297b..99a6346 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1504,6 +1504,8 @@ def execute(self, storage, ksdata, instClass):
kwargs["memberDevices"] = len(raidmems) - self.spares
kwargs["totalDevices"] = len(raidmems)
+ add_fstab_swap = None
+
# If we were given a pre-existing RAID to create a filesystem on,
# we need to verify it exists and then schedule a new format action
# to take place there. Also, we only support a subset of all the
@@ -1517,7 +1519,7 @@ def execute(self, storage, ksdata, instClass):
removeExistingFormat(device, storage)
devicetree.registerAction(ActionCreateFormat(device, kwargs["fmt"]))
if ty == "swap":
- storage.addFstabSwap(device)
+ add_fstab_swap = device
else:
if devicename and devicename in (a.name for a in storage.mdarrays):
raise KickstartValueError(formatErrorMsg(self.lineno,
@@ -1539,7 +1541,7 @@ def execute(self, storage, ksdata, instClass):
storage.createDevice(request)
if ty == "swap":
- storage.addFstabSwap(request)
+ add_fstab_swap = request
if self.encrypted:
if self.passphrase and not storage.encryptionPassphrase:
@@ -1564,8 +1566,17 @@ def execute(self, storage, ksdata, instClass):
luksdev = LUKSDevice("luks%d" % storage.nextID,
fmt=luksformat,
parents=request)
+
+ if ty == "swap":
+ # swap is on the LUKS device instead of the parent device,
+ # override the device here
+ add_fstab_swap = luksdev
+
storage.createDevice(luksdev)
+ if add_fstab_swap:
+ storage.addFstabSwap(add_fstab_swap)
+
class RepoData(commands.repo.RHEL7_RepoData):
def __init__(self, *args, **kwargs):
""" Add enabled kwarg
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/12b285e015d65789039bd6a172...
8 years
[rhel7-branch 1/2] Use the LUKS device for swap in fstab
by dashea
From: Vratislav Podzimek <vpodzime(a)redhat.com>
If we create an encrypted swap we need to use the LUKS device in fstab for such
swap not the partition/LV.
(cherry picked from commit 46ecba5aff140cd13bebce483e2dcecd3cd7dbca)
Resolves: rhbz#1302747
---
pyanaconda/kickstart.py | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 9e09fca..fe7297b 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -948,6 +948,7 @@ def execute(self, storage, ksdata, instClass):
raise KickstartValueError(formatErrorMsg(self.lineno,
msg=_("The \"%s\" file system type is not supported.") % ty))
+ add_fstab_swap = None
# If we were given a pre-existing LV to create a filesystem on, we need
# to verify it and its VG exists and then schedule a new format action
# to take place there. Also, we only support a subset of all the
@@ -971,7 +972,7 @@ def execute(self, storage, ksdata, instClass):
devicetree.registerAction(ActionCreateFormat(device, fmt))
if ty == "swap":
- storage.addFstabSwap(device)
+ add_fstab_swap = device
else:
# If a previous device has claimed this mount point, delete the
# old one.
@@ -1033,7 +1034,7 @@ def execute(self, storage, ksdata, instClass):
storage.createDevice(request)
if ty == "swap":
- storage.addFstabSwap(request)
+ add_fstab_swap = request
if self.encrypted:
if self.passphrase and not storage.encryptionPassphrase:
@@ -1060,8 +1061,16 @@ def execute(self, storage, ksdata, instClass):
luksdev = LUKSDevice("luks%d" % storage.nextID,
fmt=luksformat,
parents=request)
+ if ty == "swap":
+ # swap is on the LUKS device not on the LUKS' parent device,
+ # override the info here
+ add_fstab_swap = luksdev
+
storage.createDevice(luksdev)
+ if add_fstab_swap:
+ storage.addFstabSwap(add_fstab_swap)
+
class Logging(commands.logging.FC6_Logging):
def execute(self, *args):
if logger.loglevel == DEFAULT_LEVEL:
@@ -1300,6 +1309,7 @@ def execute(self, storage, ksdata, instClass):
kwargs["primary"] = self.primOnly
+ add_fstab_swap = None
# If we were given a pre-existing partition to create a filesystem on,
# we need to verify it exists and then schedule a new format action to
# take place there. Also, we only support a subset of all the options
@@ -1322,7 +1332,7 @@ def execute(self, storage, ksdata, instClass):
devicetree.registerAction(ActionCreateFormat(device, kwargs["fmt"]))
if ty == "swap":
- storage.addFstabSwap(device)
+ add_fstab_swap = device
# tmpfs mounts are not disks and don't occupy a disk partition,
# so handle them here
elif self.fstype == "tmpfs":
@@ -1341,7 +1351,7 @@ def execute(self, storage, ksdata, instClass):
request = storage.newPartition(**kwargs)
storage.createDevice(request)
if ty == "swap":
- storage.addFstabSwap(request)
+ add_fstab_swap = request
if self.encrypted:
if self.passphrase and not storage.encryptionPassphrase:
@@ -1368,8 +1378,17 @@ def execute(self, storage, ksdata, instClass):
luksdev = LUKSDevice("luks%d" % storage.nextID,
fmt=luksformat,
parents=request)
+
+ if ty == "swap":
+ # swap is on the LUKS device not on the LUKS' parent device,
+ # override the info here
+ add_fstab_swap = luksdev
+
storage.createDevice(luksdev)
+ if add_fstab_swap:
+ storage.addFstabSwap(add_fstab_swap)
+
class Raid(commands.raid.RHEL7_Raid):
def execute(self, storage, ksdata, instClass):
for r in self.raidList:
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/f7619bd7f85cc6e5121916b17c...
8 years