summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2001-07-06 01:53:24 +0000
committerJeremy Katz <katzj@redhat.com>2001-07-06 01:53:24 +0000
commitdde35fa5cfcd1151a05a8d4efa0609f723cb58e1 (patch)
tree27b1ff5777b4a17e99854c4d4d9bad02163a17ef
parent3e955529323e89a4a82f0c3fec858e30975f6a67 (diff)
downloadanaconda-dde35fa5cfcd1151a05a8d4efa0609f723cb58e1.tar.gz
anaconda-dde35fa5cfcd1151a05a8d4efa0609f723cb58e1.tar.xz
anaconda-dde35fa5cfcd1151a05a8d4efa0609f723cb58e1.zip
move autopart strings to bottom of file
bootable requests from partitions can be /boot/efi on ia64 make sure bootable request gets on the earliest drive possible and warn if they go beyond the 1024th cylinder on x86
-rw-r--r--autopart.py101
-rw-r--r--iw/partition_gui.py23
-rw-r--r--partitioning.py30
-rw-r--r--textw/partition_text.py17
4 files changed, 136 insertions, 35 deletions
diff --git a/autopart.py b/autopart.py
index 729502a98..2981ade0b 100644
--- a/autopart.py
+++ b/autopart.py
@@ -27,32 +27,28 @@ CLEARPART_TYPE_LINUX = 1
CLEARPART_TYPE_ALL = 2
CLEARPART_TYPE_NONE = 3
+BOOT_ABOVE_1024 = 1
-# XXX hack but these are common strings to TUI and GUI
-PARTMETHOD_TYPE_DESCR_TEXT = N_("Automatic Partitioning sets up your "
- "partitioning based on your installation type. "
- "You also "
- "can customize the resulting partitions "
- "to meet your needs.\n\n"
- "The manual disk paritioning tool Disk Druid "
- "allows you "
- "to set up your partitions in an interactive "
- "environment. You can set the filesystem "
- "types, mount points, size and more in this "
- "easy to use, powerful interface.\n\n"
- "fdisk is the traditional, text based "
- "partitioning tool offered by Red Hat. "
- "Although it is not as easy to use, there are "
- "cases where fdisk is preferred.")
-AUTOPART_DISK_CHOICE_DESCR_TEXT = N_("Before automatic partitioning can be "
- "set up by the installation program, you "
- "must choose how to use the space on "
- "hard drives.")
+# check that our "boot" partition meets necessary constraints unless
+# the request has its ignore flag set
+def bootRequestCheck(requests, diskset):
+ dev = requests.getBootableRequest()
+ if not dev or not dev.device or dev.ignoreBootConstraints:
+ return PARTITION_SUCCESS
+ part = get_partition_by_name(diskset.disks, dev.device)
+ if not part:
+ return PARTITION_SUCCESS
-CLEARPART_TYPE_ALL_DESCR_TEXT = N_("Remove all partitions on this system")
-CLEARPART_TYPE_LINUX_DESCR_TEXT = N_("Remove all Linux Partitions on this system")
-CLEARPART_TYPE_NONE_DESCR_TEXT = N_("Keep all partitions and use existing free space")
+
+ if iutil.getArch() == "ia64":
+ # XXX do ia64 boot checks here after checking with bill about specifics
+ pass
+ elif iutil.getArch() == "i386":
+ if end_sector_to_cyl(part.geom.disk.dev, part.geom.end) >= 1024:
+ return BOOT_ABOVE_1024
+
+ return PARTITION_SUCCESS
def printNewRequestsCyl(diskset, newRequest):
for req in newRequest.requests:
@@ -190,7 +186,7 @@ def fitConstrained(diskset, requests, primOnly=0, newParts = None):
# get the list of the "best" drives to try to use...
# if currentdrive is set, use that, else use the drive list, or use
# all the drives
-def getDriveList(request, diskset):
+def getDriveList(request, diskset, bootrequest = 0):
if request.currentDrive:
drives = request.currentDrive
elif request.drive:
@@ -201,6 +197,11 @@ def getDriveList(request, diskset):
if not type(drives) == type([]):
drives = [ drives ]
+ drives.sort()
+ # XXX boot drive being first drive works now, but perhaps not always =\
+ if bootrequest:
+ drives = [ drives[0] ]
+
return drives
@@ -208,6 +209,7 @@ def getDriveList(request, diskset):
# into the freespace
def fitSized(diskset, requests, primOnly = 0, newParts = None):
todo = {}
+ bootreq = requests.getBootableRequest()
for request in requests.requests:
if request.type != REQUEST_NEW:
@@ -216,7 +218,10 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None):
continue
if primOnly and not request.primary:
continue
- drives = getDriveList(request, diskset)
+ if request == bootreq:
+ drives = getDriveList(request, diskset, 1)
+ else:
+ drives = getDriveList(request, diskset)
if not todo.has_key(len(drives)):
todo[len(drives)] = [ request ]
else:
@@ -229,9 +234,13 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None):
for num in number:
for request in todo[num]:
# print "\nInserting ->",request
+ if request == bootreq:
+ isBoot = 1
+ else:
+ isBoot = 0
+
largestPart = (0, None)
- drives = getDriveList(request, diskset)
- drives.sort()
+ drives = getDriveList(request, diskset, isBoot)
# print "Trying drives to find best free space out of", free
for drive in drives:
# print "Trying drive", drive
@@ -654,10 +663,16 @@ def doPartitioning(diskset, requests, doRefresh = 1):
newParts.parts.remove(part)
del part
+ if ret != PARTITION_SUCCESS:
+ raise PartitioningError, "Growing partitions failed"
+
+ ret = bootRequestCheck(requests, diskset)
+
if ret == PARTITION_SUCCESS:
return
- raise PartitioningError, "Growing partitions failed"
+ # more specific message?
+ raise PartitioningWarning, _("Boot partition %s may not meet booting constraints for your architecture. Creation of a boot disk is highly encouraged.") %(requests.getBootableRequest().mountpoint)
# given clearpart specification execute it
# probably want to reset diskset and partition request lists before calling
@@ -665,7 +680,7 @@ def doPartitioning(diskset, requests, doRefresh = 1):
def doClearPartAction(partitions, diskset):
type = partitions.autoClearPartType
cleardrives = partitions.autoClearPartDrives
-
+
if type == CLEARPART_TYPE_LINUX:
linuxOnly = 1
elif type == CLEARPART_TYPE_ALL:
@@ -699,6 +714,7 @@ def doClearPartAction(partitions, diskset):
drive = get_partition_drive(part)
delete = DeleteSpec(drive, part.geom.start, part.geom.end)
partitions.addDelete(delete)
+
part = disk.next_partition(part)
@@ -746,3 +762,30 @@ def doAutoPartition(dir, diskset, partitions, intf):
partitions.setFromDisk(diskset)
intf.messageWindow(_("Error Partitioning"),
_("Could not allocated requested partitions: %s.") % (msg.value))
+
+
+# XXX hack but these are common strings to TUI and GUI
+PARTMETHOD_TYPE_DESCR_TEXT = N_("Automatic Partitioning sets up your "
+ "partitioning based on your installation type. "
+ "You also "
+ "can customize the resulting partitions "
+ "to meet your needs.\n\n"
+ "The manual disk paritioning tool Disk Druid "
+ "allows you "
+ "to set up your partitions in an interactive "
+ "environment. You can set the filesystem "
+ "types, mount points, size and more in this "
+ "easy to use, powerful interface.\n\n"
+ "fdisk is the traditional, text based "
+ "partitioning tool offered by Red Hat. "
+ "Although it is not as easy to use, there are "
+ "cases where fdisk is preferred.")
+
+AUTOPART_DISK_CHOICE_DESCR_TEXT = N_("Before automatic partitioning can be "
+ "set up by the installation program, you "
+ "must choose how to use the space on "
+ "hard drives.")
+
+CLEARPART_TYPE_ALL_DESCR_TEXT = N_("Remove all partitions on this system")
+CLEARPART_TYPE_LINUX_DESCR_TEXT = N_("Remove all Linux Partitions on this system")
+CLEARPART_TYPE_NONE_DESCR_TEXT = N_("Keep all partitions and use existing free space")
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index ed3a22767..427351fe8 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -1023,6 +1023,29 @@ class PartitionWindow(InstallWindow):
self.intf.messageWindow(_("Error Partitioning"),
_("Could not allocated requested partitions: %s.") % (msg))
rc = -1
+ except PartitioningWarning, msg:
+ # XXX somebody other than me should make this look better
+ dialog = GnomeDialog(_("Warning"))
+ dialog.set_parent(self.parent)
+ dialog.append_button(_("Modify Partition"))
+ dialog.append_button(_("Add anyway"))
+ dialog.set_position(WIN_POS_CENTER)
+ dialog.close_hides(TRUE)
+
+ label = GtkLabel(_("Warning: %s.") %(msg))
+ label.set_line_wrap(TRUE)
+ dialog.vbox.pack_start(label)
+ dialog.show_all()
+ rc = dialog.run()
+ dialog.close()
+ if rc != 1:
+ rc = -1
+ else:
+ rc = 0
+ req = self.partitions.getBootableRequest()
+ if req:
+ req.ignoreBootConstraints = 1
+
self.populate()
self.tree.thaw()
self.checkNextConditions()
diff --git a/partitioning.py b/partitioning.py
index 6865dcfa1..6fb150769 100644
--- a/partitioning.py
+++ b/partitioning.py
@@ -24,6 +24,7 @@ import math
import raid
import fsset
import os
+import iutil
from translate import _
from log import log
from constants import *
@@ -56,6 +57,13 @@ class PartitioningError:
def __str__ (self):
return self.value
+class PartitioningWarning:
+ def __init__ (self, value):
+ self.value = value
+
+ def __str__ (self):
+ return self.value
+
def get_flags (part):
string=""
if not part.is_active ():
@@ -455,9 +463,9 @@ class PartitionSpec:
size = None, grow = 0, maxSize = None,
mountpoint = None, origfstype = None,
start = None, end = None, partnum = None,
- drive = None, primary = None, secondary = None,
- format = None, migrate = None, options = None,
- constraint = None,
+ drive = None, primary = None,
+ format = None, options = None,
+ constraint = None, migrate = None,
raidmembers = None, raidlevel = None,
raidspares = None):
#
@@ -484,7 +492,6 @@ class PartitionSpec:
self.partnum = partnum
self.drive = drive
self.primary = primary
- self.secondary = secondary
self.format = format
self.migrate = migrate
self.options = options
@@ -507,6 +514,9 @@ class PartitionSpec:
# unique id for each request
self.uniqueID = None
+ # ignore booting constraints for this request
+ self.ignoreBootConstraints = 0
+
def __str__(self):
if self.fstype:
fsname = self.fstype.getName()
@@ -680,7 +690,12 @@ class Partitions:
# return name of boot mount point in current requests
def getBootableRequest(self):
- bootreq = self.getRequestByMountPoint("/boot")
+ bootreq = None
+
+ if not bootreq and iutil.getArch() == "ia64":
+ bootreq = self.getRequestByMountPoint("/boot/efi")
+ if not bootreq:
+ bootreq = self.getRequestByMountPoint("/boot")
if not bootreq:
bootreq = self.getRequestByMountPoint("/")
@@ -696,6 +711,11 @@ class Partitions:
self.requests[n] = request
self.requests[index] = tmp
n = n + 1
+ tmp = self.getBootableRequest()
+ if tmp:
+ index = self.requests.index(tmp)
+ self.requests[index] = self.requests[0]
+ self.requests[0] = tmp
def copy (self):
new = Partitions()
diff --git a/textw/partition_text.py b/textw/partition_text.py
index f8cfa6161..8018ed32e 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -141,7 +141,19 @@ class PartitionWindow:
except PartitioningError, msg:
self.intf.messageWindow(_("Error Partitioning"),
_("Could not allocated requested partitions: %s.") % (msg))
- rc = -1
+ rc = -1
+ except PartitioningWarning, msg:
+ rc = ButtonChoiceWindow(self.screen, _("Warning"), _("Warning: %s") %(msg),
+ buttons = [ (_("Modify Partition"), "modify"), (_("Add anyway"), "add") ])
+
+ if rc == "modify":
+ rc = -1
+ else:
+ rc = 0
+ req = self.partitions.getBootableRequest()
+ if req:
+ req.ignoreBootConstraints = 1
+
self.populate()
return rc
@@ -191,6 +203,9 @@ class PartitionWindow:
names = types.keys()
names.sort()
for name in names:
+ if not fileSystemTypeGet(name).isSupported():
+ continue
+
if fileSystemTypeGet(name).isFormattable():
fstype.append(name, types[name])
if request.fstype: