[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Add support for encrypted LVs.
- From: David Lehman <dlehman redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Add support for encrypted LVs.
- Date: Thu, 20 Mar 2008 12:25:08 -0500
---
fsset.py | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/fsset.py b/fsset.py
index 1211c2a..8573ace 100644
--- a/fsset.py
+++ b/fsset.py
@@ -2014,7 +2014,11 @@ MAILADDR root
if not os.path.isdir(rootdir):
os.makedirs(rootdir)
- dmdev = "/dev/mapper/" + root.device.getDevice().replace("-","--").replace("/", "-")
+ if root.device.crypto is None:
+ dmdev = "/dev/mapper/" + root.device.getDevice().replace("-","--").replace("/", "-")
+ else:
+ dmdev = "/dev/" + root.device.getDevice()
+
if os.path.exists(instPath + dmdev):
os.unlink(instPath + dmdev)
if not os.path.isdir(os.path.dirname(instPath + dmdev)):
@@ -2022,11 +2026,13 @@ MAILADDR root
iutil.copyDeviceNode(dmdev, instPath + dmdev)
# unlink existing so that we dtrt on upgrades
- if os.path.exists(instPath + rootDev):
+ if os.path.exists(instPath + rootDev) and not root.device.crypto:
os.unlink(instPath + rootDev)
if not os.path.isdir(rootdir):
os.makedirs(rootdir)
- os.symlink(dmdev, instPath + rootDev)
+
+ if root.device.crypto is None:
+ os.symlink(dmdev, instPath + rootDev)
if not os.path.isdir("%s/etc/lvm" %(instPath,)):
os.makedirs("%s/etc/lvm" %(instPath,))
@@ -2503,8 +2509,8 @@ class VolumeGroupDevice(Device):
class LogicalVolumeDevice(Device):
# note that size is in megabytes!
- def __init__(self, vgname, size, lvname, vg, existing = 0):
- Device.__init__(self)
+ def __init__(self, vgname, size, lvname, vg, existing = 0, encryption=None):
+ Device.__init__(self, encryption=encryption)
self.vgname = vgname
self.size = size
self.name = lvname
@@ -2521,6 +2527,9 @@ class LogicalVolumeDevice(Device):
# self.readaheadsectors
def setupDevice(self, chroot="/", devPrefix='/dev', vgdevice = None):
+ if self.crypto:
+ self.crypto.setDevice("mapper/%s-%s" % (self.vgname, self.name))
+
if not self.isSetup:
lvm.lvcreate(self.name, self.vgname, self.size)
self.isSetup = 1
@@ -2528,10 +2537,19 @@ class LogicalVolumeDevice(Device):
if vgdevice and vgdevice.isNetdev():
self.setAsNetdev()
+ if self.crypto:
+ self.crypto.formatDevice()
+ self.crypto.openDevice()
+
return "/dev/%s" % (self.getDevice(),)
def getDevice(self, asBoot = 0):
- return "%s/%s" % (self.vgname, self.name)
+ if self.crypto and not asBoot:
+ device = self.crypto.getDevice()
+ else:
+ device = "%s/%s" % (self.vgname, self.name)
+
+ return device
def solidify(self):
return
--
1.5.4.1
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]