diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | packages.py | 1 | ||||
-rw-r--r-- | partedUtils.py | 68 | ||||
-rw-r--r-- | partitioning.py | 1 |
4 files changed, 57 insertions, 21 deletions
@@ -1,3 +1,11 @@ +2007-03-28 Chris Lumens <clumens@redhat.com> + + * partedUtils.py (DiskSet.clearDevices): Move the clearpart logic out + of openDevices since we don't want to do it every time openDevices is + called, which is fairly often (#232936). + * packages.py (turnOnFilesystems): Call clearDevices. + * partitioning.py (partitioningComplete): Likewise. + 2007-03-27 Jeremy Katz <katzj@redhat.com> * liveinst/liveinst.sh: Support using hal locking by running diff --git a/packages.py b/packages.py index c5cfff198..7c6d322df 100644 --- a/packages.py +++ b/packages.py @@ -141,6 +141,7 @@ def turnOnFilesystems(anaconda): if flags.setupFilesystems: if not anaconda.id.upgrade: anaconda.id.partitions.doMetaDeletes(anaconda.id.diskset) + anaconda.id.diskset.clearDevices() anaconda.id.fsset.setActive(anaconda.id.diskset) if not anaconda.id.fsset.isActive(): anaconda.id.diskset.savePartitions () diff --git a/partedUtils.py b/partedUtils.py index 0dffc60b0..3f98fdf4d 100644 --- a/partedUtils.py +++ b/partedUtils.py @@ -990,6 +990,48 @@ class DiskSet: return 1 + def clearDevices (self): + def inClearDevs (drive, clearDevs): + return (clearDevs is None) or (len(clearDevs) == 0) or (drive in clearDevs) + + clearDevs = [] + initAll = False + + if self.anaconda is not None and self.anaconda.isKickstart: + clearDevs = self.anaconda.id.ksdata.clearpart.drives + initAll = self.anaconda.id.ksdata.clearpart.initAll + + for drive in self.driveList(): + # ignoredisk takes precedence over clearpart (#186438). + if drive in DiskSet.skippedDisks: + continue + + deviceFile = isys.makeDevInode(drive, "/dev/" + drive) + + if not isys.mediaPresent(drive): + DiskSet.skippedDisks.append(drive) + continue + + try: + dev = parted.PedDevice.get (deviceFile) + except parted.error, msg: + DiskSet.skippedDisks.append(drive) + continue + + if initAll and inClearDevs(drive, clearDevs) and not flags.test \ + and not hasProtectedPartitions(drive, self.anaconda): + if rhpl.getArch() == "s390" and drive[:4] == "dasd": + if self.dasdFmt(drive): + DiskSet.skippedDrives.append(drive) + continue + else: + try: + disk = dev.disk_new_fresh(getDefaultDiskType()) + disk.commit() + except parted.error, msg: + DiskSet.skippedDisks.append(drive) + continue + def openDevices (self): """Open the disks on the system and skip unopenable devices.""" @@ -1017,11 +1059,11 @@ class DiskSet: ks = False clearDevs = [] initAll = False - if self.anaconda is not None: - if self.anaconda.isKickstart: - ks = True - clearDevs = self.anaconda.id.ksdata.clearpart.drives - initAll = self.anaconda.id.ksdata.clearpart.initAll + + if self.anaconda is not None and self.anaconda.isKickstart: + ks = True + clearDevs = self.anaconda.id.ksdata.clearpart.drives + initAll = self.anaconda.id.ksdata.clearpart.initAll # FIXME: need the right fix for z/VM formatted dasd if rhpl.getArch() == "s390" and drive[:4] == "dasd" and isys.getDasdState(drive): @@ -1060,22 +1102,6 @@ class DiskSet: DiskSet.skippedDisks.append(drive) continue - if initAll and ((clearDevs is None) or (len(clearDevs) == 0) \ - or (drive in clearDevs)) and not flags.test \ - and not hasProtectedPartitions(drive, self.anaconda): - if rhpl.getArch() == "s390" and drive[:4] == "dasd": - if self.dasdFmt(drive): - DiskSet.skippedDisks.append(drive) - continue - else: - try: - disk = dev.disk_new_fresh(getDefaultDiskType()) - disk.commit() - self.disks[drive] = disk - except parted.error, msg: - DiskSet.skippedDisks.append(drive) - continue - try: disk = parted.PedDisk.new(dev) self.disks[drive] = disk diff --git a/partitioning.py b/partitioning.py index 5d5a3c672..9a8d31ff7 100644 --- a/partitioning.py +++ b/partitioning.py @@ -100,6 +100,7 @@ def partitioningComplete(anaconda): if rc: anaconda.id.partitions.doMetaDeletes(anaconda.id.diskset) + anaconda.id.diskset.clearDevices() anaconda.id.fsset.setActive(anaconda.id.diskset) anaconda.id.diskset.savePartitions () anaconda.id.fsset.createLogicalVolumes(anaconda.rootPath) |