On Mon, 2012-03-26 at 15:03 -0500, Mark Hamzy wrote: > This fixes two bugs. The first is that the PReP partition is not created > during a text mode install. The second is that the PReP partition needs > to be zeroed out before grub is run. Grub verifies that no data exists > on the partition before installation. > > Updated the code per dlehman's recommendations... > > --- > pyanaconda/storage/formats/prepboot.py | 28 ++++++++++++++++++++++++++++ > pyanaconda/storage/partitioning.py | 3 ++- > 2 files changed, 30 insertions(+), 1 deletions(-) > > diff --git a/pyanaconda/storage/formats/prepboot.py b/pyanaconda/storage/formats/prepboot.py > index b7d1c60..9b65a4d 100644 > --- a/pyanaconda/storage/formats/prepboot.py > +++ b/pyanaconda/storage/formats/prepboot.py > @@ -23,6 +23,9 @@ > from ..errors import * > from . import DeviceFormat, register_device_format > from parted import PARTITION_PREP > +import os > +import logging > +log = logging.getLogger("storage") > > class PPCPRePBoot(DeviceFormat): > """ Generic device format. """ > @@ -46,6 +49,31 @@ class PPCPRePBoot(DeviceFormat): > """ > DeviceFormat.__init__(self, *args, **kwargs) > > + def create(self, *args, **kwargs): > + if self.exists: > + raise FSError("PReP Boot format already exists") > + > + DeviceFormat.create(self, *args, **kwargs) > + > + try: > + fd = os.open(self.device, os.O_RDWR) > + length = os.lseek(fd, 0, os.SEEK_END) > + os.lseek(fd, 0, os.SEEK_SET) > + buf = '\0' * 1024 * 1024 Do we really need a 1MB buffer in memory to write 1MB of zeros to disk? I know it's Python, but this is quite a lot of unnecessary data. > + while length > 0: > + if length >= len(buf): > + os.write(fd, buf) > + length -= len(buf) > + else: > + buf = '0' * length > + os.write(fd, buf) > + length = 0 > + os.close(fd) > + except OSError as e: > + log.error("error zeroing out %s: %s" % (self.device, e)) > + if fd: > + os.close(fd) > + > @property > def status(self): > return False > diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py > index 49faa78..c380b0c 100644 > --- a/pyanaconda/storage/partitioning.py > +++ b/pyanaconda/storage/partitioning.py > @@ -120,7 +120,8 @@ def _schedulePartitions(storage, disks): > > if request.fstype is None: > request.fstype = storage.defaultFSType > - elif request.fstype == "prepboot" and storage.bootLoaderDevice: > + elif request.fstype == "prepboot" and storage.bootLoaderDevice and \ > + storage.bootLoaderDevice != storage.bootDevice: > # there should never be a need for more than one of these > # partitions, so skip them. > log.info("skipping unneeded stage1 prepboot request") -- Vratislav Podzimek _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list