summaryrefslogtreecommitdiffstats
path: root/partRequests.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2007-12-11 17:54:49 -0500
committerJeremy Katz <katzj@redhat.com>2007-12-11 17:56:22 -0500
commitd5f5f146347408136065dee429c11b2f44b31772 (patch)
tree5e741dfd34ce352c1fa8a0e503dfd4d688285354 /partRequests.py
parentae1b98e7dd5038a0a11ee03d46220c76727585e8 (diff)
downloadanaconda-d5f5f146347408136065dee429c11b2f44b31772.tar.gz
anaconda-d5f5f146347408136065dee429c11b2f44b31772.tar.xz
anaconda-d5f5f146347408136065dee429c11b2f44b31772.zip
Better checking for bootable request on an encrypted device
Do the checking for if the bootable request is on an encrypted device in the final sanity check rather than at request add. This makes it so that you can add /boot later. Takes advantage of the new request.isEncrypted() method which checks base devs for LVM and RAID
Diffstat (limited to 'partRequests.py')
-rw-r--r--partRequests.py62
1 files changed, 32 insertions, 30 deletions
diff --git a/partRequests.py b/partRequests.py
index a7664047a..d0e6c93d1 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -193,11 +193,16 @@ class RequestSpec:
import traceback
traceback.print_stack()
- def isResizable(self):
- if self.encryption: # encrypted devices can't be resized currently
+ def isResizable(self, partitions):
+ if self.isEncrypted(partitions): # FIXME: can't resize crypted devs yet
return False
return self.resizable and self.fstype.isResizable()
+ def isEncrypted(self, partitions):
+ if self.encryption and self.encryption.getScheme() is not None:
+ return True
+ return False
+
def toEntry(self, partitions):
"""Turn a request into a fsset entry and return the entry."""
device = self.getDevice(partitions)
@@ -256,10 +261,6 @@ class RequestSpec:
if self.fstype is None:
return None
- # FIXME: this will need to become more sophisticated at some point
- if self.encryption and self.mountpoint in ('/', '/boot'):
- return _("This mount point cannot be on an encrypted partition.")
-
if flags.livecdInstall and self.mountpoint == "/" and not self.format:
return _("The mount point %s must be formatted during live CD "
"installs.") % self.mountpoint
@@ -686,6 +687,14 @@ class RaidRequestSpec(RequestSpec):
encryption = self.encryption)
return self.dev
+ def isEncrypted(self, partitions):
+ if RequestSpec.isEncrypted(self, partitions) is True:
+ return True
+ for member in self.raidmembers:
+ if partitions.getRequestByID(member).isEncrypted(partitions):
+ return True
+ return False
+
def getActualSize(self, partitions, diskset):
"""Return the actual size allocated for the request in megabytes."""
@@ -726,13 +735,6 @@ class RaidRequestSpec(RequestSpec):
if not self.raidmembers or not self.raidlevel:
return _("No members in RAID request, or not RAID "
"level specified.")
- # XXX fix this code to look to see if there is a bootable partition
- bootreq = partitions.getBootableRequest()
- if not bootreq and self.mountpoint:
- # XXX 390 can't have boot on raid
- if (self.mountpoint in partitions.getBootableMountpoints()
- and not raid.isRaid1(self.raidlevel)):
- return _("Bootable partitions can only be on RAID1 devices.")
minmembers = raid.get_raid_min_members(self.raidlevel)
if len(self.raidmembers) < minmembers:
@@ -757,14 +759,6 @@ class RaidRequestSpec(RequestSpec):
if rc:
return rc
- # make sure we aren't attempting encrypted /boot or /
- if self.mountpoint in ('/', '/boot'):
- for member in self.raidmembers:
- r = partitions.getRequestByID(member)
- if r.encryption and r.encryption.getScheme() is not None:
- return _("This mount point cannot be on a RAID device "
- "containing encrypted partitions.")
-
return RequestSpec.sanityCheckRequest(self, partitions)
class VolumeGroupRequestSpec(RequestSpec):
@@ -839,6 +833,15 @@ class VolumeGroupRequestSpec(RequestSpec):
existing = self.preexist)
return self.dev
+ def isEncrypted(self, partitions):
+ if RequestSpec.isEncrypted(self, partitions) is True:
+ return True
+ for pvid in self.physicalVolumes:
+ pv = partitions.getRequestByID(pvid)
+ if pv.isEncrypted(partitions):
+ return True
+ return False
+
def getActualSize(self, partitions, diskset):
"""Return the actual size allocated for the request in megabytes."""
@@ -958,6 +961,14 @@ class LogicalVolumeRequestSpec(RequestSpec):
existing = self.preexist)
return self.dev
+ def isEncrypted(self, partitions):
+ if RequestSpec.isEncrypted(self, partitions) is True:
+ return True
+ vg = partitions.getRequestByID(self.volumeGroup)
+ if vg.isEncrypted(partitions):
+ return True
+ return False
+
def getActualSize(self, partitions = None, diskset = None, target = False):
"""Return the actual size allocated for the request in megabytes."""
if self.percent:
@@ -994,15 +1005,6 @@ class LogicalVolumeRequestSpec(RequestSpec):
return _("Logical volume size must be larger than the volume "
"group's physical extent size.")
- # make sure it's not encrypted /boot or /
- if self.mountpoint in ('/boot', '/'):
- vgreq = partitions.getRequestByID(self.volumeGroup)
- for pv in vgreq.physicalVolumes:
- r = partitions.getRequestByID(pv)
- if r.encryption and r.encryption.getScheme() is not None:
- return _("This mount point cannot be on a logical volume "
- "containing encrypted physical volumes.")
-
return RequestSpec.sanityCheckRequest(self, partitions, skipMntPtExistCheck)
def getMaximumResizeMB(self, partitions):