summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog36
-rwxr-xr-xanaconda2
-rw-r--r--fsset.py29
-rw-r--r--installclass.py2
-rw-r--r--instdata.py8
-rw-r--r--kickstart.py12
-rw-r--r--partedUtils.py115
-rw-r--r--partitioning.py5
-rw-r--r--upgrade.py6
9 files changed, 122 insertions, 93 deletions
diff --git a/ChangeLog b/ChangeLog
index 905cd7b44..a7e96d566 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2006-12-13 David Cantrell <dcantrell@redhat.com>
+
+ * anaconda (__main__): Pass reference to anaconda object to InstallData.
+
+ * fsset.py (readFstab): Take reference to anaconda object rather than
+ a path and intf. Pass anaconda reference to DiskSet().
+ * fssey.py (__main__): Removed.
+
+ * installclass.py (BaseInstallClass): Pass anaconda reference to the
+ reset() method for InstallData.
+
+ * instdata.py (InstallData.reset): Take anaconda object reference as
+ parameter. Pass anaconda to DiskSet().
+ * instdata.py (InstallData.__init__): Take anaconda object ref as
+ parameter, pass it to reset() method.
+
+ * kickstart.py (AnacondaKSHandlers): Store anaconda object reference,
+ pass to DiskSet() object creations.
+
+ * partedUtils.py (DiskSet): Take anaconda object reference, store. Use
+ self.anaconda throughout DiskSet object, remove individual pass-ins
+ of intf and other anaconda object parts.
+ * partedUtils.py (DiskSet.dastFmt): Remove -P dasdfmt(8) arg (#218861).
+ * partedUtils.py (DiskSet.openDevices): Remove intf, initAll, zeroMbr,
+ and clearDevs params since those are in the anaconda object. When a
+ kickstart install is running, the dasd found is in the clearpart list,
+ and the --initlabel option has been used, skip the interactive dialog
+ asking if you want to format the DASD and just do it (#218861).
+
+ * partitioning.py (partitionObjectsInitialize): Removed arguments since
+ the anaconda object provides those now.
+
+ * upgrade.py (mountRootPartition): Pass anaconda object ref to DiskSet.
+ Only pass anaconda ref to readFstab().
+ * upgrade.py (upgradeMountFilesystems): Likewise.
+
2006-12-13 Jeremy Katz <katzj@redhat.com>
From Elliot Peele <elliot@rpath.com>
diff --git a/anaconda b/anaconda
index 6f4925b02..a591c788c 100755
--- a/anaconda
+++ b/anaconda
@@ -738,7 +738,7 @@ if __name__ == "__main__":
import rescue, instdata
- anaconda.id = instdata.InstallData([], "fd0", anaconda.methodstr, opts.display_mode)
+ anaconda.id = instdata.InstallData(anaconda, [], "fd0", anaconda.methodstr, opts.display_mode)
rescue.runRescue(anaconda)
# shouldn't get back here
diff --git a/fsset.py b/fsset.py
index dbcc4d41a..d2a3d7e17 100644
--- a/fsset.py
+++ b/fsset.py
@@ -2465,13 +2465,15 @@ def makeDevice(dev):
return device
# XXX fix RAID
-def readFstab (path, intf = None):
+def readFstab (anaconda):
+ path = anaconda.rootPath + '/etc/fstab'
+ intf = anaconda.intf
fsset = FileSystemSet()
# first, we look at all the disks on the systems and get any ext2/3
# labels off of the filesystem.
# temporary, to get the labels
- diskset = partedUtils.DiskSet()
+ diskset = partedUtils.DiskSet(anaconda)
diskset.openDevices()
labels = diskset.getLabels()
@@ -2850,26 +2852,3 @@ def getDiskPart(dev):
partNum = None
return (name, partNum)
-
-
-if __name__ == "__main__":
- fsset = readFstab("fstab")
-
- print fsset.fstab()
-
- sys.exit(0)
- fsset = FileSystemSet()
- proc = FileSystemSetEntry(Device(), '/proc', 'proc')
- fsset.add(proc)
- devpts = FileSystemSetEntry(Device(), '/dev/pts', 'devpts')
- fsset.add(devpts)
-
- device = LoopbackDevice("hda1", "vfat")
- mountpoint = FileSystemSetEntry (device, '/')
- fsset.add(mountpoint)
-
- device = SwapFileDevice("/SWAP")
- mountpoint = FileSystemSetEntry (device, "swap", "swap")
- fsset.add(mountpoint)
-
- print fsset.fstab()
diff --git a/installclass.py b/installclass.py
index 6e6f7c81f..0503e9516 100644
--- a/installclass.py
+++ b/installclass.py
@@ -424,7 +424,7 @@ class BaseInstallClass:
def setInstallData(self, anaconda):
- anaconda.id.reset()
+ anaconda.id.reset(anaconda)
anaconda.id.instClass = self
# Classes should call these on __init__ to set up install data
diff --git a/instdata.py b/instdata.py
index 39f79eb8a..af26c4fe9 100644
--- a/instdata.py
+++ b/instdata.py
@@ -44,7 +44,7 @@ log = logging.getLogger("anaconda")
class InstallData:
- def reset(self):
+ def reset(self, anaconda):
# Reset everything except:
#
# - The mouse
@@ -65,7 +65,7 @@ class InstallData:
self.upgrade = None
# XXX move fsset and/or diskset into Partitions object?
self.fsset.reset()
- self.diskset = partedUtils.DiskSet()
+ self.diskset = partedUtils.DiskSet(anaconda)
self.partitions = partitions.Partitions()
self.bootloader = bootloader.getBootloader()
self.dependencies = []
@@ -257,7 +257,7 @@ class InstallData:
os.chmod(filename, 0600)
- def __init__(self, extraModules, floppyDevice, methodstr, displayMode, backend = None):
+ def __init__(self, anaconda, extraModules, floppyDevice, methodstr, displayMode, backend = None):
self.displayMode = displayMode
self.instLanguage = language.Language(self.displayMode)
@@ -278,4 +278,4 @@ class InstallData:
self.excludeDocs = 1
self.methodstr = methodstr
- self.reset()
+ self.reset(anaconda)
diff --git a/kickstart.py b/kickstart.py
index 1e590438e..6646f8a1e 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -97,7 +97,8 @@ class AnacondaKSHandlers(KickstartHandlers):
# XXX hack to give us a starting point for RAID, LVM, etc unique IDs.
self.ksID = 100000
- self.id = anaconda.id
+ self.anaconda = anaconda
+ self.id = self.anaconda.id
self.lineno = 0
self.currentCmd = ""
@@ -308,7 +309,7 @@ class AnacondaKSHandlers(KickstartHandlers):
KickstartHandlers.doMultiPath(self, args)
from partedUtils import DiskSet
- ds = DiskSet()
+ ds = DiskSet(self.anaconda)
ds.startMPath()
mpath = self.ksdata.mpaths[-1]
@@ -334,7 +335,7 @@ class AnacondaKSHandlers(KickstartHandlers):
KickstartHandlers.doDmRaid(self, args)
from partedUtils import DiskSet
- ds = DiskSet()
+ ds = DiskSet(self.anaconda)
ds.startDmRaid()
raid = self.ksdata.dmraids[-1]
@@ -781,12 +782,13 @@ class Kickstart(cobject):
def setInstallData (self, anaconda):
BaseInstallClass.setInstallData(self, anaconda)
self.setEarlySwapOn(1)
- self.id = anaconda.id
+ self.anaconda = anaconda
+ self.id = self.anaconda.id
self.id.firstboot = FIRSTBOOT_SKIP
# make sure our disks are alive
from partedUtils import DiskSet
- ds = DiskSet()
+ ds = DiskSet(self.anaconda)
ds.startMPath()
ds.startDmRaid()
diff --git a/partedUtils.py b/partedUtils.py
index bb05f7b06..5dd0861f9 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -552,9 +552,10 @@ class DiskSet:
dmList = None
mpList = None
- def __init__ (self):
+ def __init__ (self, anaconda):
self.disks = {}
self.onlyPrimary = None
+ self.anaconda = anaconda
def onlyPrimaryParts(self):
for disk in self.disks.values():
@@ -701,7 +702,7 @@ class DiskSet:
return labels
- def findExistingRootPartitions(self, anaconda, upgradeany = 0):
+ def findExistingRootPartitions(self, upgradeany = 0):
"""Return a list of all of the partitions which look like a root fs."""
rootparts = []
@@ -717,15 +718,15 @@ class DiskSet:
found = 0
for fs in fsset.getFStoTry(dev):
try:
- isys.mount(dev, anaconda.rootPath, fs, readOnly = 1)
+ isys.mount(dev, self.anaconda.rootPath, fs, readOnly = 1)
found = 1
break
except SystemError, (errno, msg):
pass
if found:
- if os.access (anaconda.rootPath + '/etc/fstab', os.R_OK):
- relstr = getReleaseString(anaconda.rootPath)
+ if os.access (self.anaconda.rootPath + '/etc/fstab', os.R_OK):
+ relstr = getReleaseString(self.anaconda.rootPath)
if ((upgradeany == 1) or
(productMatches(relstr, productName))):
@@ -735,7 +736,7 @@ class DiskSet:
label = None
rootparts.append ((dev, fs, relstr, label))
- isys.umount(anaconda.rootPath)
+ isys.umount(self.anaconda.rootPath)
# now, look for candidate lvm roots
lvm.vgscan()
@@ -748,15 +749,15 @@ class DiskSet:
found = 0
for fs in fsset.getFStoTry(dev):
try:
- isys.mount(dev, anaconda.rootPath, fs, readOnly = 1)
+ isys.mount(dev, self.anaconda.rootPath, fs, readOnly = 1)
found = 1
break
except SystemError:
pass
if found:
- if os.access (anaconda.rootPath + '/etc/fstab', os.R_OK):
- relstr = getReleaseString(anaconda.rootPath)
+ if os.access (self.anaconda.rootPath + '/etc/fstab', os.R_OK):
+ relstr = getReleaseString(self.anaconda.rootPath)
if ((upgradeany == 1) or
(productMatches(relstr, productName))):
@@ -766,7 +767,7 @@ class DiskSet:
label = None
rootparts.append ((dev, fs, relstr, label))
- isys.umount(anaconda.rootPath)
+ isys.umount(self.anaconda.rootPath)
lvm.vgdeactivate()
@@ -791,19 +792,19 @@ class DiskSet:
# In hard drive ISO method, don't try to mount the
# protected partitions because that'll throw up a
# useless error message.
- protected = anaconda.method.protectedPartitions()
+ protected = self.anaconda.method.protectedPartitions()
if protected and node in protected:
part = disk.next_partition(part)
continue
try:
- isys.mount(node, anaconda.rootPath, part.fs_type.name)
+ isys.mount(node, self.anaconda.rootPath, part.fs_type.name)
except SystemError, (errno, msg):
part = disk.next_partition(part)
continue
- if os.access (anaconda.rootPath + '/etc/fstab', os.R_OK):
- relstr = getReleaseString(anaconda.rootPath)
+ if os.access (self.anaconda.rootPath + '/etc/fstab', os.R_OK):
+ relstr = getReleaseString(self.anaconda.rootPath)
if ((upgradeany == 1) or
(productMatches(relstr, productName))):
@@ -814,7 +815,7 @@ class DiskSet:
rootparts.append ((node, part.fs_type.name,
relstr, label))
- isys.umount(anaconda.rootPath)
+ isys.umount(self.anaconda.rootPath)
part = disk.next_partition(part)
return rootparts
@@ -874,12 +875,11 @@ class DiskSet:
del disk
self.refreshDevices()
- def refreshDevices (self, intf = None, initAll = 0,
- zeroMbr = 0, clearDevs = []):
+ def refreshDevices (self):
"""Reread the state of the disks as they are on disk."""
self.closeDevices()
self.disks = {}
- self.openDevices(intf, initAll, zeroMbr, clearDevs)
+ self.openDevices()
def closeDevices (self):
"""Close all of the disks which are open."""
@@ -889,13 +889,13 @@ class DiskSet:
#self.disks[disk].close()
del self.disks[disk]
- def dasdFmt (self, intf = None, drive = None):
+ def dasdFmt (self, drive = None):
"""Format dasd devices (s390)."""
if self.disks.has_key(drive):
del self.disks[drive]
- w = intf.progressWindow (_("Initializing"),
+ w = self.anaconda.intf.progressWindow (_("Initializing"),
_("Please wait while formatting drive %s...\n"
) % (drive,), 100)
try:
@@ -907,7 +907,6 @@ class DiskSet:
"-y",
"-b", "4096",
"-d", "cdl",
- "-P",
"-F",
"-f",
"/tmp/%s" % drive]
@@ -971,14 +970,14 @@ class DiskSet:
return 1
- def openDevices (self, intf = None, initAll = 0,
- zeroMbr = 0, clearDevs = []):
+ def openDevices (self):
"""Open the disks on the system and skip unopenable devices."""
if self.disks:
return
self.startMPath()
self.startDmRaid()
+
for drive in self.driveList():
# ignoredisk takes precedence over clearpart (#186438).
if drive in DiskSet.skippedDisks:
@@ -987,14 +986,26 @@ class DiskSet:
if not isys.mediaPresent(drive):
DiskSet.skippedDisks.append(drive)
continue
+
+ if self.anaconda.isKickstart:
+ cdl = self.anaconda.ksdata.clearpart["drives"]
+ initlbl = self.anaconda.ksdata.clearpart["initAll"]
+ else:
+ cdl = []
+ initlbl = False
+
# FIXME: need the right fix for z/VM formatted dasd
if rhpl.getArch() == "s390" and drive[:4] == "dasd" and isys.getDasdState(drive):
devs = isys.getDasdDevPort()
- if intf is None:
+ if self.anaconda.intf is None:
DiskSet.skippedDisks.append(drive)
continue
- rc = intf.messageWindow(_("Warning"),
- _("The partition table on device %s (%s) was unreadable. "
+
+ if self.anaconda.isKickstart and (drive in cdl) and initlbl:
+ rc = 1
+ else:
+ rc = self.anaconda.intf.messageWindow(_("Warning"),
+ _("The partition table on device %s (%s) was unreadable. "
"To create new partitions it must be initialized, "
"causing the loss of ALL DATA on this drive.\n\n"
"This operation will override any previous "
@@ -1003,11 +1014,12 @@ class DiskSet:
"Would you like to initialize this drive, "
"erasing ALL DATA?")
% (drive, devs[drive]), type = "yesno")
+
if rc == 0:
DiskSet.skippedDisks.append(drive)
continue
else:
- if (self.dasdFmt(intf, drive)):
+ if (self.dasdFmt(drive)):
DiskSet.skippedDisks.append(drive)
continue
@@ -1017,10 +1029,9 @@ 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):
+ if not flags.test:
if rhpl.getArch() == "s390" and drive[:4] == "dasd":
- if (intf is None or self.dasdFmt(intf, drive)):
+ if self.dasdFmt(drive):
DiskSet.skippedDisks.append(drive)
continue
else:
@@ -1037,29 +1048,33 @@ class DiskSet:
self.disks[drive] = disk
except parted.error, msg:
recreate = 0
- if zeroMbr:
+ if self.anaconda.id.partitions.zeroMbr:
log.error("zeroMBR was set and invalid partition table "
"found on %s" % (dev.path[5:]))
recreate = 1
- elif not intf:
+ elif not self.anaconda.intf:
DiskSet.skippedDisks.append(drive)
continue
else:
if rhpl.getArch() == "s390" and drive[:4] == "dasd":
- devs = isys.getDasdDevPort()
- format = drive + " (" + devs[drive] + ")"
+ devs = isys.getDasdDevPort()
+ format = drive + " (" + devs[drive] + ")"
else:
- format = drive
- rc = intf.messageWindow(_("Warning"),
- _("The partition table on device %s was unreadable. "
- "To create new partitions it must be initialized, "
- "causing the loss of ALL DATA on this drive.\n\n"
- "This operation will override any previous "
- "installation choices about which drives to "
- "ignore.\n\n"
- "Would you like to initialize this drive, "
- "erasing ALL DATA?")
- % (format,), type = "yesno")
+ format = drive
+
+ if self.anaconda.isKickstart and (drive in cdl) and initlbl:
+ rc = 1
+ else:
+ rc = intf.messageWindow(_("Warning"),
+ _("The partition table on device %s was unreadable. "
+ "To create new partitions it must be initialized, "
+ "causing the loss of ALL DATA on this drive.\n\n"
+ "This operation will override any previous "
+ "installation choices about which drives to "
+ "ignore.\n\n"
+ "Would you like to initialize this drive, "
+ "erasing ALL DATA?") % (format,), type = "yesno")
+
if rc == 0:
DiskSet.skippedDisks.append(drive)
continue
@@ -1068,7 +1083,7 @@ class DiskSet:
if recreate == 1 and not flags.test:
if rhpl.getArch() == "s390" and drive[:4] == "dasd":
- if (intf is None or self.dasdFmt(intf, drive)):
+ if self.dasdFmt(drive):
DiskSet.skippedDisks.append(drive)
continue
else:
@@ -1088,13 +1103,13 @@ class DiskSet:
filter_partitions(disk, validateFsType)
# check that their partition table is valid for their architecture
- ret = checkDiskLabel(disk, intf)
+ ret = checkDiskLabel(disk)
if ret == 1:
DiskSet.skippedDisks.append(drive)
continue
elif ret == -1:
if rhpl.getArch() == "s390" and drive[:4] == "dasd":
- if (intf is None or self.dasdFmt(intf, drive)):
+ if self.dasdFmt(drive):
DiskSet.skippedDisks.append(drive)
continue
else:
@@ -1166,10 +1181,10 @@ class DiskSet:
part = disk.next_partition(part)
return rc
- def checkNoDisks(self, intf):
+ def checkNoDisks(self):
"""Check that there are valid disk devices."""
if len(self.disks.keys()) == 0:
- intf.messageWindow(_("No Drives Found"),
+ self.anaconda.intf.messageWindow(_("No Drives Found"),
_("An error has occurred - no valid devices were "
"found on which to create new file systems. "
"Please check your hardware for the cause "
diff --git a/partitioning.py b/partitioning.py
index dc7140973..5d5a3c672 100644
--- a/partitioning.py
+++ b/partitioning.py
@@ -48,10 +48,7 @@ def partitionObjectsInitialize(anaconda):
isys.flushDriveDict()
# 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.refreshDevices()
anaconda.id.partitions.setFromDisk(anaconda.id.diskset)
anaconda.id.partitions.setProtected(anaconda.dispatch)
diff --git a/upgrade.py b/upgrade.py
index ce646c612..52e7002e3 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -123,7 +123,7 @@ def mountRootPartition(anaconda, rootInfo, oldfsset, allowDirty = 0,
warnDirty = 0, readOnly = 0):
(root, rootFs) = rootInfo
- diskset = partedUtils.DiskSet()
+ diskset = partedUtils.DiskSet(anaconda)
diskset.openDevices()
diskset.startMPath()
diskset.startDmRaid()
@@ -135,7 +135,7 @@ def mountRootPartition(anaconda, rootInfo, oldfsset, allowDirty = 0,
isys.mount(root, anaconda.rootPath, rootFs)
oldfsset.reset()
- newfsset = readFstab(anaconda.rootPath + '/etc/fstab', anaconda.intf)
+ newfsset = readFstab(anaconda)
for entry in newfsset.entries:
oldfsset.add(entry)
@@ -352,7 +352,7 @@ def upgradeMountFilesystems(anaconda):
type="ok")
return DISPATCH_BACK
- newfsset = readFstab(anaconda.rootPath + '/etc/fstab', anaconda.intf)
+ newfsset = readFstab(anaconda)
for entry in newfsset.entries:
anaconda.id.fsset.add(entry)
if flags.setupFilesystems: