diff options
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | dmraid.py | 39 | ||||
-rw-r--r-- | fsset.py | 4 | ||||
-rw-r--r-- | partedUtils.py | 96 | ||||
-rw-r--r-- | partitioning.py | 19 | ||||
-rw-r--r-- | partitions.py | 13 | ||||
-rw-r--r-- | upgrade.py | 12 |
7 files changed, 106 insertions, 94 deletions
@@ -1,3 +1,20 @@ +2006-07-26 Peter Jones <pjones@redhat.com> + + * dmraid.py: consolidate startRaidDev and startAllRaid, likewise for + stop. fix mpath names in device cache. name startAllMPath like + everything else. + + * partedUtils.py: split up startAllRaid and stopAllRaid into individual + functions for MdRaid, DmRaid, and MPath. + + * fsset.py: call individual start/stop functions + + * partitioning.py: ditto + + * partitions.py: ditto + + * upgrade.py: ditto + 2006-07-26 Jeremy Katz <katzj@redhat.com> * lang-table: Add Kannada @@ -146,13 +146,6 @@ def scanForRaid(drives, degradedOk=False): def renameRaidSet(rs, name): cacheDrives.rename(rs, name) -def startRaidDev(rs): - if flags.dmraid == 0: - return - rs.prefix = '/dev/mapper/' - log.debug("starting raid %s with mknod=True" % (rs,)) - rs.activate(mknod=True) - def startAllRaid(driveList): """Do a raid start on raid devices.""" @@ -162,20 +155,11 @@ def startAllRaid(driveList): dmList = scanForRaid(driveList) for rs in dmList: - startRaidDev(rs) + rs.prefix = '/dev/mapper/' + log.debug("starting raid %s with mknod=True" % (rs,)) + rs.activate(mknod=True) return dmList -def stopRaidSet(rs): - if flags.dmraid == 0: - return - log.debug("stopping raid %s" % (rs,)) - name = "mapper/" + rs.name - if name in cacheDrives: - cacheDrives.remove(name) - - rs.deactivate() - #block.removeDeviceMap(map) - def stopAllRaid(dmList): """Do a raid stop on each of the raid device tuples given.""" @@ -183,7 +167,12 @@ def stopAllRaid(dmList): return log.debug("stopping all dmraids") for rs in dmList: - stopRaidSet(rs) + log.debug("stopping raid %s" % (rs,)) + if rs.name in cacheDrives: + cacheDrives.remove(rs.name) + + rs.deactivate() + #block.removeDeviceMap(map) def isRaid6(raidlevel): """Return whether raidlevel is a valid descriptor of RAID6.""" @@ -256,7 +245,7 @@ def startMPath(mpath): log.debug("starting mpath %s with mknod=True" % (mpath,)) mpath.activate(mknod=True) -def startAllMPaths(driveList): +def startAllMPath(driveList): """Start all of the MPaths of the specified drives.""" if not flags.mpath: @@ -271,15 +260,15 @@ def startAllMPaths(driveList): def stopMPath(mp): if flags.mpath == 0: return + log.debug("stopping mpath %s" % (mp,)) - name = "mapper/" + mp.name - if name in cacheDrives: - cacheDrives.remove(name) + if mp.name in cacheDrives: + cacheDrives.remove(mp.name) mp.deactivate() #block.removeDeviceMap(map) -def stopAllMPaths(mpList): +def stopAllMPath(mpList): """Do a mpath stop on each of the mpath device tuples given.""" if not flags.mpath: @@ -125,8 +125,8 @@ class LabelFactory: self.labels = {} diskset = partedUtils.DiskSet() diskset.openDevices() - diskset.stopAllRaid(stopDmRaid=False) - diskset.startAllRaid() + diskset.stopMdRaid() + diskset.startMdRaid() labels = diskset.getLabels() del diskset self.reserveLabels(labels) diff --git a/partedUtils.py b/partedUtils.py index 5734644ce..2604650e7 100644 --- a/partedUtils.py +++ b/partedUtils.py @@ -559,9 +559,9 @@ class DiskSet: def startMPath(self): """Start all of the dm multipath devices associated with the DiskSet.""" + if rhpl.getArch() in ('s390', 's390x'): return - if not DiskSet.mpList is None: return @@ -572,16 +572,28 @@ class DiskSet: self.driveList()) log.debug("DiskSet.skippedDisks: %s" % (DiskSet.skippedDisks,)) - mpList = dmraid.startAllMPaths(driveList) + mpList = dmraid.startAllMPath(driveList) DiskSet.mpList = mpList log.debug("done starting mpaths. Drivelist: %s" % \ (self.driveList(),)) def renameMPath(self, mp, name): + if rhpl.getArch() in ('s390', 's390x'): + return dmraid.renameMPath(mp, name) + + def stopMPath(self): + """Stop all of the mpath devices associated with the DiskSet.""" + + if rhpl.getArch() in ('s390', 's390x'): + return + if DiskSet.mpList: + dmraid.stopAllMPath(DiskSet.mpList) + DiskSet.mpList = None def startDmRaid(self): """Start all of the dmraid devices associated with the DiskSet.""" + if rhpl.getArch() in ('s390', 's390x'): return if not DiskSet.dmList is None: @@ -600,68 +612,46 @@ class DiskSet: (self.driveList(),)) def renameDmRaid(self, rs, name): + if rhpl.getArch() in ('s390', 's390x'): + return dmraid.renameRaidSet(rs, name) - def startAllRaid(self, startDmRaid=True, startMPath=True, startMdRaid=True): - """Start all of the raid devices associated with the DiskSet.""" - testList = DiskSet.skippedDisks - - if not rhpl.getArch() in ('s390','s390x'): - if startMPath: - if self.mpList is None: - self.startMPath() - for mp in DiskSet.mpList or []: - for m in mp.members: - disk = m.split('/')[-1] - testList.append(disk) -# self.refreshDevices() - - if startMdRaid: - if self.dmList is None: - self.startDmRaid() - for rs in DiskSet.dmList or []: - for m in rs.members: - if isinstance(m, block.RaidDev): - disk = m.rd.device.path.split('/')[-1] - testList.append(disk) -# self.refreshDevices() - - if startMdRaid: - driveList = filter(lambda x: x not in testList, self.driveList()) - DiskSet.mdList.extend(raid.startAllRaid(driveList)) - -# self.refreshDevices() + def stopDmRaid(self): + """Stop all of the dmraid devices associated with the DiskSet.""" - def stopMPath(self): - """Stop all of the MPaths associated with the DiskSet.""" - if not DiskSet.mpList: + if rhpl.getArch() in ('s390', 's390x'): return + if DiskSet.dmList or []: + dmraid.stopAllRaid(DiskSet.dmList) + DiskSet.dmList = None - dmraid.stopAllMPaths(DiskSet.mpList) - DiskSet.mpList = None + def startMdRaid(self): + """Start all of the md raid devices associated with the DiskSet.""" - def stopDmRaid(self): - """Stop all of the dmraid devices associated with the DiskSet.""" - if not DiskSet.dmList: - return + testList = DiskSet.skippedDisks - dmraid.stopAllRaid(DiskSet.dmList) - DiskSet.dmList = None + if not rhpl.getArch() in ('s390','s390x'): + for mp in DiskSet.mpList or []: + for m in mp.members: + disk = m.split('/')[-1] + testList.append(disk) + for rs in DiskSet.dmList or []: + for m in rs.members: + if isinstance(m, block.RaidDev): + disk = m.rd.device.path.split('/')[-1] + testList.append(disk) - def stopAllRaid(self, stopDmRaid=True, stopMPath=True): - """Stop all of the raid devices associated with the DiskSet.""" + driveList = filter(lambda x: x not in testList, self.driveList()) + DiskSet.mdList.extend(raid.startAllRaid(driveList)) + + def stopMdRaid(self): + """Stop all of the md raid devices associated with the DiskSet.""" raid.stopAllRaid(DiskSet.mdList) while DiskSet.mdList: DiskSet.mdList.pop() - if stopDmRaid and DiskSet.dmList: - self.stopDmRaid() - - if stopMPath and DiskSet.mpList: - self.stopMPath() - def getLabels(self): """Return a list of all of the labels used on partitions.""" labels = {} @@ -700,7 +690,9 @@ class DiskSet: """Return a list of all of the partitions which look like a root fs.""" rootparts = [] - self.startAllRaid() + self.startMPath() + self.startDmRaid() + self.startMdRaid() if flags.cmdline.has_key("upgradeany"): upgradeany = 1 @@ -764,7 +756,7 @@ class DiskSet: lvm.vgdeactivate() # don't stop raid until after we've looked for lvm on top of it - self.stopAllRaid(stopDmRaid=False, stopMPath=False) + self.stopMdRaid() drives = self.disks.keys() drives.sort() diff --git a/partitioning.py b/partitioning.py index 1808f82db..064cebe2d 100644 --- a/partitioning.py +++ b/partitioning.py @@ -33,7 +33,11 @@ def partitionObjectsInitialize(anaconda): return # shut down all dm devices - anaconda.id.diskset.stopAllRaid(stopDmRaid=True, stopMPath=True) + anaconda.id.diskset.closeDevices() + anaconda.id.diskset.stopMdRaid() + anaconda.id.diskset.closeDevices() + anaconda.id.diskset.stopDmRaid() + anaconda.id.diskset.stopMPath() # clean slate about drives isys.flushDriveDict() @@ -41,12 +45,15 @@ def partitionObjectsInitialize(anaconda): # ensure iscsi devs are up anaconda.id.iscsi.startup(anaconda.intf) - # start mpath and dmraid devices - anaconda.id.diskset.startAllRaid(startMdRaid=False) - # 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.intf, + anaconda.id.partitions.reinitializeDisks, + anaconda.id.partitions.zeroMbr, + anaconda.id.partitions.autoClearPartDrives) + + # start mpath and dmraid devices + anaconda.id.diskset.startMPath() + anaconda.id.diskset.startDmRaid() anaconda.id.diskset.checkNoDisks(anaconda.intf) diff --git a/partitions.py b/partitions.py index f13ac6b54..25079e96d 100644 --- a/partitions.py +++ b/partitions.py @@ -142,7 +142,9 @@ class Partitions: part = disk.next_partition(part) # now we need to read in all pre-existing RAID stuff - diskset.startAllRaid() + diskset.startMPath() + diskset.startDmRaid() + diskset.startMdRaid() mdList = diskset.mdList for raidDev in mdList: (theDev, devices, level, numActive) = raidDev @@ -266,7 +268,7 @@ class Partitions: lvm.vgdeactivate() - diskset.stopAllRaid(stopDmRaid=False, stopMPath=False) + diskset.stopMdRaid() def addRequest (self, request): """Add a new request to the list.""" @@ -1317,7 +1319,9 @@ class Partitions: """Does the removal of all of the non-physical volumes in the delete list.""" # have to have lvm on, which requires raid to be started - diskset.startAllRaid() + diskset.startMPath() + diskset.startDmRaid() + diskset.startMdRaid() lvm.vgactivate() snapshots = {} @@ -1356,8 +1360,7 @@ class Partitions: delete.setDeleted(1) lvm.vgdeactivate() - diskset.stopAllRaid(stopDmRaid=False, stopMPath=False) - + diskset.stopMdRaid() def deleteDependentRequests(self, request): """Handle deletion of this request and all requests which depend on it. diff --git a/upgrade.py b/upgrade.py index 08d6fc345..bc506c3b8 100644 --- a/upgrade.py +++ b/upgrade.py @@ -123,7 +123,9 @@ def mountRootPartition(anaconda, rootInfo, oldfsset, allowDirty = 0, diskset = partedUtils.DiskSet() diskset.openDevices() - diskset.startAllRaid() + diskset.startMPath() + diskset.startDmRaid() + diskset.startMdRaid() lvm.vgscan() lvm.vgactivate() @@ -139,15 +141,17 @@ def mountRootPartition(anaconda, rootInfo, oldfsset, allowDirty = 0, dirtyDevs = oldfsset.hasDirtyFilesystems(anaconda.rootPath) if not allowDirty and dirtyDevs != []: - diskset.stopAllRaid() lvm.vgdeactivate() - anaconda.intf.messageWindow(_("Dirty File Systems"), + diskset.stopMdRaid() + diskset.stopDmRaid() + diskset.stopMPath() + anaconda.intf.messageWindow(_("Dirty File Systems"), _("The following file systems for your Linux system " "were not unmounted cleanly. Please boot your " "Linux installation, let the file systems be " "checked and shut down cleanly to upgrade.\n" "%s" %(getDirtyDevString(dirtyDevs),))) - sys.exit(0) + sys.exit(0) elif warnDirty and dirtyDevs != []: rc = anaconda.intf.messageWindow(_("Dirty File Systems"), _("The following file systems for your Linux " |