# # partitioning.py: partitioning and other disk management # # Matt Wilson # Jeremy Katz # Mike Fulbright # Harald Hoyer # # Copyright 2001-2003 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import isys import sys import iutil from constants import * from flags import flags from partErrors import * from rhpl.translate import _ def partitionObjectsInitialize(anaconda): if anaconda.dir == DISPATCH_BACK: anaconda.id.diskset.closeDevices() anaconda.id.iscsi.shutdown() isys.flushDriveDict() return # clean slate about drives isys.flushDriveDict() # ensure iscsi devs are up anaconda.id.iscsi.startup(anaconda.intf) # read in drive info anaconda.id.diskset.refreshDevices(anaconda.intf, anaconda.id.partitions.reinitializeDisks, anaconda.id.partitions.zeroMbr, anaconda.id.partitions.autoClearPartDrives) anaconda.id.diskset.checkNoDisks(anaconda.intf) anaconda.id.partitions.setFromDisk(anaconda.id.diskset) anaconda.id.partitions.setProtected(anaconda.dispatch) # make sure we have all the device nodes we'll want iutil.makeDriveDeviceNodes() def partitioningComplete(anaconda): if anaconda.dir == DISPATCH_BACK and anaconda.id.fsset.isActive(): rc = anaconda.intf.messageWindow(_("Installation cannot continue."), _("The partitioning options you have chosen " "have already been activated. You can " "no longer return to the disk editing " "screen. Would you like to continue " "with the installation process?"), type = "yesno") if rc == 0: sys.exit(0) return DISPATCH_FORWARD anaconda.id.partitions.sortRequests() anaconda.id.fsset.reset() for request in anaconda.id.partitions.requests: # XXX improve sanity checking if (not request.fstype or (request.fstype.isMountable() and not request.mountpoint)): continue entry = request.toEntry(anaconda.id.partitions) if entry: anaconda.id.fsset.add (entry) else: raise RuntimeError, ("Managed to not get an entry back from " "request.toEntry") if (not flags.setupFilesystems or iutil.memAvailable() > isys.EARLY_SWAP_RAM): return if not anaconda.isKickstart: rc = anaconda.intf.messageWindow(_("Low Memory"), _("As you don't have much memory in this " "machine, we need to turn on swap space " "immediately. To do this we'll have to " "write your new partition table to the disk " "immediately. Is that OK?"), "yesno") else: rc = 1 if rc: anaconda.id.partitions.doMetaDeletes(anaconda.id.diskset) anaconda.id.fsset.setActive(anaconda.id.diskset) anaconda.id.diskset.savePartitions () anaconda.id.fsset.createLogicalVolumes(anaconda.rootPath) anaconda.id.fsset.formatSwap(anaconda.rootPath) anaconda.id.fsset.turnOnSwap(anaconda.rootPath) return