summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--fsset.py16
-rw-r--r--partedUtils.py21
-rw-r--r--partitions.py14
4 files changed, 48 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 33f2ae044..07d908366 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2007-07-26 Peter Jones <pjones@redhat.com>
+
+ * gpt.py:
+ - new file! Utility functions for GPT-related stuff. Right
+ now the name is something of a misnomer, since it only houses MBR
+ writing code.
+
+ * partedUtils.py:
+ - move hasGptLabel here from partitions.py
+ - do gptsync on i386 and x86_64 if /boot is on a gpt disk
+ - change parted errors to log as errors not debug
+
+ * fsset.py (FileSystemSet.setActive):
+ - set the first gpt partition as bootable on i386/x86_64 if it's the
+ boot device
+
+ * partitions.py (Partitions.sanityCheckAllRequests):
+ - don't complain about /boot on GPT on i386/x86_64 any more.
+
2007-07-26 David Cantrell <dcantrell@redhat.com>
* yuminstall.py (YumBackend.__init__): Make sure skipFormatRoot is
diff --git a/fsset.py b/fsset.py
index 7b120ace8..8bd750da4 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1392,22 +1392,26 @@ MAILADDR root
bootDev = dev.device
+ part = partedUtils.get_partition_by_name(diskset.disks, bootDev)
+ drive = partedUtils.get_partition_drive(part)
+
# on ia64, *only* /boot/efi should be marked bootable
# similarly, on pseries, we really only want the PReP partition active
if rhpl.getArch() == "ia64" \
- or (rhpl.getArch() in ("i386", "x86_64") and iutil.isEfi()) \
- or iutil.getPPCMachine() in ("pSeries", "iSeries", "PMac"):
- part = partedUtils.get_partition_by_name(diskset.disks, bootDev)
+ or iutil.getPPCMachine() in ("pSeries", "iSeries", "PMac") \
+ or (rhpl.getArch() in ("i386", "x86_64") \
+ and (iutil.isEfi() \
+ or partedUtils.hasGptLabel(diskset, drive))):
if part and part.is_flag_available(parted.PARTITION_BOOT):
part.set_flag(parted.PARTITION_BOOT, 1)
return
-
+
for drive in diskset.disks.keys():
foundActive = 0
bootPart = None
- disk = diskset.disks[drive]
- if disk.dev.disk_probe().name == "gpt":
+ if partedUtils.hasGptLabel(diskset, drive):
continue
+ disk = diskset.disks[drive]
part = disk.next_partition()
while part:
if not part.is_active():
diff --git a/partedUtils.py b/partedUtils.py
index 59ab4228f..5685cef96 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -272,6 +272,10 @@ def getDefaultDiskType():
else:
return parted.disk_type_get("msdos")
+def hasGptLabel(diskset, device):
+ disk = diskset.disks[device]
+ return disk.type.name == "gpt"
+
archLabels = {'i386': ['msdos', 'gpt'],
's390': ['dasd', 'msdos'],
'alpha': ['bsd', 'msdos'],
@@ -913,10 +917,13 @@ class DiskSet:
continue
# FIXME: this belongs in parted itself, but let's do a hack...
- if iutil.isMactel() and disk.type.name == "gpt" and \
- os.path.exists("/usr/sbin/gptsync"):
- iutil.execWithRedirect("/usr/sbin/gptsync", [disk.dev.path],
- stdout="/dev/tty5", stderr="/dev/tty5")
+ if rhpl.getArch() in ("i386", "x86_64") \
+ and disk.type.name == "gpt":
+ log.debug("syncing gpt to mbr for disk %s" % (disk.dev.path,))
+ iutil.execWithRedirect("gptsync", [disk.dev.path,],
+ stdout="/tmp/gptsync.log",
+ stderr="/tmp/gptsync.err",
+ searchPath = 1)
del disk
self.refreshDevices()
@@ -1092,7 +1099,7 @@ class DiskSet:
else:
disk = labelDisk(deviceFile)
except parted.error, msg:
- log.debug("parted error: %s" % (msg,))
+ log.error("parted error: %s" % (msg,))
raise
except:
exc = sys.exc_info()
@@ -1229,6 +1236,10 @@ class DiskSet:
if rc == 0:
sys.exit(0)
else:
+ exc = sys.exc_info()
+ exc = traceback.format_exception(*exc)
+ for line in exc.splitlines():
+ log.error(line)
log.error(str)
sys.exit(0)
diff --git a/partitions.py b/partitions.py
index 5abc7fb93..e716c8f50 100644
--- a/partitions.py
+++ b/partitions.py
@@ -800,10 +800,6 @@ class Partitions:
boot.extend(self.requests)
self.requests = boot
- def hasGptLabel(self, diskset, device):
- disk = diskset.disks[device]
- return disk.type.name == "gpt"
-
def sanityCheckAllRequests(self, diskset, baseChecks = 0):
"""Do a sanity check of all of the requests.
@@ -853,7 +849,7 @@ class Partitions:
if ok:
for br in getBaseReqs([bootreq,]):
(disk, num) = fsset.getDiskPart(br.device)
- if not self.hasGptLabel(diskset, disk):
+ if not partedUtils.hasGptLabel(diskset, disk):
ok = False
if not ok:
errors.append(_("You must create a /boot/efi partition of "
@@ -865,16 +861,12 @@ class Partitions:
(dev, num) = fsset.getDiskPart(br.device)
if iutil.isMactel():
- if self.hasGptLabel(diskset, dev) and int(num) > 4:
+ if partedUtils.hasGptLabel(diskset, dev) \
+ and int(num) > 4:
errors.append(
_("Your boot partition isn't on one of "
"the first four partitions and thus "
"won't be bootable."))
- elif self.hasGptLabel(diskset, dev):
- errors.append(_("Your boot partition is on a disk "
- "using the GPT partitioning scheme "
- "but this machine cannot boot using "
- "GPT."))
if rhpl.getArch() == "ia64":
bootreq = self.getRequestByMountPoint("/boot/efi")