summaryrefslogtreecommitdiffstats
path: root/autopart.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-02-11 03:25:50 +0000
committerJeremy Katz <katzj@redhat.com>2003-02-11 03:25:50 +0000
commitf331f6551588ef2234204ffa8c81a8a1aa4ee1d6 (patch)
tree20dbea1a943b0578a8da83b9bfefddd3a8b16606 /autopart.py
parenta755df42cc0b38aa5bef7be65529ec91ec27ca32 (diff)
downloadanaconda-f331f6551588ef2234204ffa8c81a8a1aa4ee1d6.tar.gz
anaconda-f331f6551588ef2234204ffa8c81a8a1aa4ee1d6.tar.xz
anaconda-f331f6551588ef2234204ffa8c81a8a1aa4ee1d6.zip
add (undocumented) preexisting lvm/raid support to kickstart. use
the partition strings in error cases to avoid breaking string freeze (should be fixed post gingin) Adds the following: raid / --device md0 --useexisting Use existing raid device md0, don't format it raid /home --device md0 --noformat Use existing raid device, but format it volgroup myvg --noformat volgroup myvg --useexisting Use existing volume group. Doesn't run vgcreate logvol /foo --vgname=myvg --name=root --noformat Reuse existing logical volume myvg/root and don't format logvol / --vgname=myvg --name=root --useexisting Reuse existing logical volume myvg/root and format it clearpart --none For completeness sake (and because I tried to use it :-) These aren't really supported but are there so that people can play with them and hopefully find the bugs before taroon :) Also has the side effect of probably fixing the occasional traceback mikem sees with lvm that I haven't reproduced (but got something similar to while testing this stuff)
Diffstat (limited to 'autopart.py')
-rw-r--r--autopart.py86
1 files changed, 85 insertions, 1 deletions
diff --git a/autopart.py b/autopart.py
index 263d277c3..8ad5fcec2 100644
--- a/autopart.py
+++ b/autopart.py
@@ -1152,7 +1152,8 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch):
drives = partitions.autoClearPartDrives
for request in partitions.autoPartitionRequests:
- if request.device:
+ if (isinstance(request, partRequests.PartitionSpec) and
+ request.device):
# get the preexisting partition they want to use
req = partitions.getRequestByDeviceName(request.device)
if not req or not req.type or req.type != REQUEST_PREEXIST:
@@ -1177,6 +1178,89 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch):
else:
req.format = 1
req.fstype = request.fstype
+ # XXX whee! lots of cut and paste code lies below
+ elif (isinstance(request, partRequests.RaidRequestSpec) and
+ request.preexist == 1):
+ req = partitions.getRequestByDeviceName(request.device)
+ if not req or req.preexist == 0:
+ intf.messageWindow(_("Requested Partition Does Not Exist"),
+ _("Unable to locate partition %s to use "
+ "for %s.\n\n"
+ "Press 'OK' to reboot your system.")
+ % (request.device,
+ request.mountpoint),
+ custom_icon='error')
+ sys.exit(0)
+
+ # now go through and set things from the request to the
+ # preexisting partition's request... ladeda
+ if request.mountpoint:
+ req.mountpoint = request.mountpoint
+ if request.badblocks:
+ req.badblocks = request.badblocks
+ if request.uniqueID: # for raid to work
+ req.uniqueID = request.uniqueID
+ if not request.format:
+ req.format = 0
+ else:
+ req.format = 1
+ req.fstype = request.fstype
+ # XXX not copying the raid bits because they should be handled
+ # automagically (actually, people probably aren't specifying them)
+
+ elif (isinstance(request, partRequests.VolumeGroupRequestSpec) and
+ request.preexist == 1):
+ # get the preexisting partition they want to use
+ req = partitions.getRequestByVolumeGroupName(request.volumeGroupName)
+ if not req or req.preexist == 0 or req.format == 1:
+ intf.messageWindow(_("Requested Partition Does Not Exist"),
+ _("Unable to locate partition %s to use "
+ "for %s.\n\n"
+ "Press 'OK' to reboot your system.")
+ % (request.volumeGroupName,
+ request.mountpoint),
+ custom_icon='error')
+ sys.exit(0)
+
+ # now go through and set things from the request to the
+ # preexisting partition's request... ladeda
+ if request.physicalVolumes:
+ req.physicalVolumes = request.physicalVolumes
+ if request.pesize:
+ req.pesize = request.pesize
+ if request.uniqueID: # for raid to work
+ req.uniqueID = request.uniqueID
+ if not request.format:
+ req.format = 0
+ else:
+ req.format = 1
+ elif (isinstance(request, partRequests.LogicalVolumeRequestSpec) and
+ request.preexist == 1):
+ # get the preexisting partition they want to use
+ req = partitions.getRequestByLogicalVolumeName(request.logicalVolumeName)
+ if not req or req.preexist == 0:
+ intf.messageWindow(_("Requested Partition Does Not Exist"),
+ _("Unable to locate partition %s to use "
+ "for %s.\n\n"
+ "Press 'OK' to reboot your system.")
+ % (request.logicalVolumeName,
+ request.mountpoint),
+ custom_icon='error')
+ sys.exit(0)
+
+ # now go through and set things from the request to the
+ # preexisting partition's request... ladeda
+ if request.volumeGroup:
+ req.volumeGroup = request.volumeGroup
+ if request.mountpoint:
+ req.mountpoint = request.mountpoint
+ if request.uniqueID: # for raid to work
+ req.uniqueID = request.uniqueID
+ if not request.format:
+ req.format = 0
+ else:
+ req.format = 1
+ req.fstype = request.fstype
else:
req = copy.copy(request)
if req.type == REQUEST_NEW and not req.drive: