summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2008-03-20 12:13:23 -0500
committerDavid Lehman <dlehman@redhat.com>2008-03-26 12:52:56 -0500
commitb2a300b02016f9cfdef8201ddfe9bbee396b2309 (patch)
tree750c6d52b71f27214799c7c0d54b91a9537e3096 /fsset.py
parentffb45a463d7d3534d51c1f47a155c9e74d255330 (diff)
downloadanaconda-b2a300b02016f9cfdef8201ddfe9bbee396b2309.tar.gz
anaconda-b2a300b02016f9cfdef8201ddfe9bbee396b2309.tar.xz
anaconda-b2a300b02016f9cfdef8201ddfe9bbee396b2309.zip
Add support for encrypted LVs.
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/fsset.py b/fsset.py
index 6d6253e5b..92c7b5160 100644
--- a/fsset.py
+++ b/fsset.py
@@ -2019,7 +2019,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)):
@@ -2027,11 +2031,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,))
@@ -2508,8 +2514,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
@@ -2526,6 +2532,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
@@ -2533,10 +2542,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