Fixing firstboot module
This commit is contained in:
parent
0376606424
commit
9487d3dfb1
@ -3,8 +3,8 @@
|
|||||||
# Copyright 2006 Red Hat, Inc.
|
# Copyright 2006 Red Hat, Inc.
|
||||||
# Author: Jarod Wilson <jwilson@redhat.com>
|
# Author: Jarod Wilson <jwilson@redhat.com>
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# Neil Horman <nhorman@redhat.com>
|
# Neil Horman <nhorman@redhat.com>
|
||||||
# Dave Lehman <dlehman@redhat.com>
|
# Dave Lehman <dlehman@redhat.com>
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -31,337 +31,346 @@ import os.path
|
|||||||
import time
|
import time
|
||||||
import gtk
|
import gtk
|
||||||
import gobject
|
import gobject
|
||||||
import functions
|
|
||||||
import commands
|
import commands
|
||||||
import rhpl.executil as executil
|
import rhpl.executil as executil
|
||||||
from firstboot import start_process
|
from firstboot.config import *
|
||||||
|
from firstboot.constants import *
|
||||||
|
from firstboot.functions import *
|
||||||
|
from firstboot.module import *
|
||||||
|
|
||||||
from rhpl.translate import _, N_
|
from rhpl.translate import _, N_
|
||||||
from rhpl import translate
|
from rhpl import translate
|
||||||
translate.textdomain("firstboot")
|
translate.textdomain("firstboot")
|
||||||
|
|
||||||
|
class moduleClass(Module):
|
||||||
|
def __init__(self):
|
||||||
|
Module.__init__(self)
|
||||||
|
self.priority = 100
|
||||||
|
self.sidebarTitle = N_("Kdump")
|
||||||
|
self.title = N_("Kdump")
|
||||||
|
|
||||||
class childWindow:
|
# runPriority determines the order in which this module runs in firstboot
|
||||||
# runPriority determines the order in which this module runs in firstboot
|
runPriority = 70
|
||||||
runPriority = 70
|
moduleName = _("Kdump")
|
||||||
moduleName = _("Kdump")
|
windowName = moduleName
|
||||||
windowName = moduleName
|
needsReboot = False
|
||||||
needsReboot = False
|
|
||||||
|
|
||||||
# possible bootloaders we'll need to adjust
|
# possible bootloaders we'll need to adjust
|
||||||
# bootloader : (config file, kdump offset)
|
# bootloader : (config file, kdump offset)
|
||||||
bootloaders = { "grub" : ("/boot/grub/grub.conf", 16),
|
bootloaders = { "grub" : ("/boot/grub/grub.conf", 16),
|
||||||
"yaboot" : ("/boot/etc/yaboot.conf", 32),
|
"yaboot" : ("/boot/etc/yaboot.conf", 32),
|
||||||
"elilo" : ("/boot/efi/EFI/redhat/elilo.conf", 256) }
|
"elilo" : ("/boot/efi/EFI/redhat/elilo.conf", 256) }
|
||||||
bootloader = None
|
bootloader = None
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
# list of architectures without kdump support
|
# list of architectures without kdump support
|
||||||
unsupportedArches = [ "ppc", "s390", "s390x", "i386", "i586" ]
|
unsupportedArches = [ "ppc", "s390", "s390x", "i386", "i586" ]
|
||||||
|
|
||||||
# list of platforms that have a separate kernel-kdump
|
# list of platforms that have a separate kernel-kdump
|
||||||
kernelKdumpArches = [ "ppc64" ]
|
kernelKdumpArches = [ "ppc64" ]
|
||||||
kernelKdumpInstalled = False
|
kernelKdumpInstalled = False
|
||||||
|
|
||||||
# toggle sensitivity of kdump config bits
|
# toggle sensitivity of kdump config bits
|
||||||
def showHide(self, status):
|
def showHide(self, status):
|
||||||
self.totalMem.set_sensitive(status)
|
self.totalMem.set_sensitive(status)
|
||||||
self.kdumpMem.set_sensitive(status)
|
self.kdumpMem.set_sensitive(status)
|
||||||
self.systemUsableMem.set_sensitive(status)
|
self.systemUsableMem.set_sensitive(status)
|
||||||
self.labelTotal.set_sensitive(status)
|
self.labelTotal.set_sensitive(status)
|
||||||
self.labelKdump.set_sensitive(status)
|
self.labelKdump.set_sensitive(status)
|
||||||
self.labelSys.set_sensitive(status)
|
self.labelSys.set_sensitive(status)
|
||||||
self.kdumpEnabled = status
|
self.kdumpEnabled = status
|
||||||
|
|
||||||
def on_enableKdumpCheck_toggled(self, *args):
|
def on_enableKdumpCheck_toggled(self, *args):
|
||||||
showHideStatus = self.enableKdumpCheck.get_active()
|
showHideStatus = self.enableKdumpCheck.get_active()
|
||||||
self.showHide(showHideStatus)
|
self.showHide(showHideStatus)
|
||||||
|
|
||||||
def updateAvail(self, widget, spin):
|
def updateAvail(self, widget, spin):
|
||||||
self.remMem = self.availMem - spin.get_value_as_int()
|
self.remMem = self.availMem - spin.get_value_as_int()
|
||||||
self.systemUsableMem.set_text("%s" % self.remMem)
|
self.systemUsableMem.set_text("%s" % self.remMem)
|
||||||
|
|
||||||
def getBootloader(self):
|
def getBootloader(self):
|
||||||
for (name, (conf, offset)) in self.bootloaders.items():
|
for (name, (conf, offset)) in self.bootloaders.items():
|
||||||
if os.access(conf, os.W_OK):
|
if os.access(conf, os.W_OK):
|
||||||
self.bootloader = name
|
self.bootloader = name
|
||||||
return self.bootloader
|
return self.bootloader
|
||||||
|
|
||||||
def launch(self, doDebug = None):
|
def createScreen(self, doDebug = None):
|
||||||
self.doDebug = doDebug
|
self.doDebug = doDebug
|
||||||
|
|
||||||
if doDebug:
|
if doDebug:
|
||||||
print "initializing kdump module"
|
print "initializing kdump module"
|
||||||
|
|
||||||
# What kernel are we running?
|
# What kernel are we running?
|
||||||
self.runningKernel = os.popen("/bin/uname -r").read().strip()
|
self.runningKernel = os.popen("/bin/uname -r").read().strip()
|
||||||
|
|
||||||
# What arch are we running on?
|
# What arch are we running on?
|
||||||
self.arch = os.popen("/bin/uname -m").read().strip()
|
self.arch = os.popen("/bin/uname -m").read().strip()
|
||||||
|
|
||||||
# Check for a xen kernel, kdump doesn't work w/xen just yet...
|
# Check for a xen kernel, kdump doesn't work w/xen just yet...
|
||||||
self.xenKernel = self.runningKernel.find("xen")
|
self.xenKernel = self.runningKernel.find("xen")
|
||||||
|
|
||||||
# Fedora or RHEL?
|
# Fedora or RHEL?
|
||||||
releaseFile = '/etc/redhat-release'
|
releaseFile = '/etc/redhat-release'
|
||||||
self.distro = 'rhel'
|
self.distro = 'rhel'
|
||||||
lines = open(releaseFile).readlines()
|
lines = open(releaseFile).readlines()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.find("Fedora") != -1:
|
if line.find("Fedora") != -1:
|
||||||
self.distro = 'fedora'
|
self.distro = 'fedora'
|
||||||
kernelKdumpArchesFC = [ "i686", "x86_64" ]
|
kernelKdumpArchesFC = [ "i686", "x86_64" ]
|
||||||
self.kernelKdumpArches.extend(kernelKdumpArchesFC)
|
self.kernelKdumpArches.extend(kernelKdumpArchesFC)
|
||||||
break
|
break
|
||||||
|
|
||||||
# If we need kernel-kdump, check to see if its already installed
|
# If we need kernel-kdump, check to see if its already installed
|
||||||
if self.arch in self.kernelKdumpArches:
|
if self.arch in self.kernelKdumpArches:
|
||||||
self.kernelKdump = "/boot/vmlinux-%skdump" % self.runningKernel
|
self.kernelKdump = "/boot/vmlinux-%skdump" % self.runningKernel
|
||||||
if os.access(self.kernelKdump, os.R_OK):
|
if os.access(self.kernelKdump, os.R_OK):
|
||||||
self.kernelKdumpInstalled = True
|
self.kernelKdumpInstalled = True
|
||||||
|
|
||||||
# Ascertain how much memory is in the system
|
# Ascertain how much memory is in the system
|
||||||
memInfo = open("/proc/meminfo").readlines()
|
memInfo = open("/proc/meminfo").readlines()
|
||||||
self.availMem = 0
|
self.availMem = 0
|
||||||
for line in memInfo:
|
for line in memInfo:
|
||||||
if line.startswith("MemTotal:"):
|
if line.startswith("MemTotal:"):
|
||||||
self.availMem = int(line.split()[1]) / 1024
|
self.availMem = int(line.split()[1]) / 1024
|
||||||
break
|
break
|
||||||
|
|
||||||
# Fix up memory calculations if kdump is already on
|
# Fix up memory calculations if kdump is already on
|
||||||
cmdLine = open("/proc/cmdline").read()
|
cmdLine = open("/proc/cmdline").read()
|
||||||
self.kdumpMem = 0
|
self.kdumpMem = 0
|
||||||
self.kdumpOffset = 0
|
self.kdumpOffset = 0
|
||||||
self.origCrashKernel = ""
|
self.origCrashKernel = ""
|
||||||
chkConfigStatus=commands.getoutput('/sbin/chkconfig --list kdump')
|
chkConfigStatus=commands.getoutput('/sbin/chkconfig --list kdump')
|
||||||
if chkConfigStatus.find("on") > -1:
|
if chkConfigStatus.find("on") > -1:
|
||||||
self.kdumpEnabled = True
|
self.kdumpEnabled = True
|
||||||
self.kdumpMemInitial = 0
|
self.kdumpMemInitial = 0
|
||||||
if cmdLine.find("crashkernel") > -1:
|
if cmdLine.find("crashkernel") > -1:
|
||||||
crashString = filter(lambda t: t.startswith("crashkernel="),
|
crashString = filter(lambda t: t.startswith("crashkernel="),
|
||||||
cmdLine.split())[0].split("=")[1]
|
cmdLine.split())[0].split("=")[1]
|
||||||
if self.doDebug:
|
if self.doDebug:
|
||||||
print "crashString is %s" % crashString
|
print "crashString is %s" % crashString
|
||||||
(self.kdumpMem, self.kdumpOffset) = [int(m[:-1]) for m in crashString.split("@")]
|
(self.kdumpMem, self.kdumpOffset) = [int(m[:-1]) for m in crashString.split("@")]
|
||||||
self.availMem += self.kdumpMem
|
self.availMem += self.kdumpMem
|
||||||
self.origCrashKernel = "%dM@%dM" % (self.kdumpMem, self.kdumpOffset)
|
self.origCrashKernel = "%dM@%dM" % (self.kdumpMem, self.kdumpOffset)
|
||||||
self.kdumpMemInitial = self.kdumpMem
|
self.kdumpMemInitial = self.kdumpMem
|
||||||
else:
|
else:
|
||||||
self.kdumpEnabled = False
|
self.kdumpEnabled = False
|
||||||
self.kdumpMemInitial = 0
|
self.kdumpMemInitial = 0
|
||||||
self.initialState = self.kdumpEnabled
|
self.initialState = self.kdumpEnabled
|
||||||
|
|
||||||
# Do some sanity-checking and try to present only sane options.
|
# Do some sanity-checking and try to present only sane options.
|
||||||
#
|
#
|
||||||
# Defaults
|
# Defaults
|
||||||
lowerBound = 128
|
lowerBound = 128
|
||||||
minUsable = 256
|
minUsable = 256
|
||||||
step = 64
|
step = 64
|
||||||
self.enoughMem = True
|
self.enoughMem = True
|
||||||
if self.arch == 'ia64':
|
if self.arch == 'ia64':
|
||||||
# ia64 usually needs at *least* 256M, page-aligned... :(
|
# ia64 usually needs at *least* 256M, page-aligned... :(
|
||||||
lowerBound = 256
|
lowerBound = 256
|
||||||
minUsable = 512
|
minUsable = 512
|
||||||
step = 256
|
step = 256
|
||||||
elif self.arch == 'ppc64':
|
elif self.arch == 'ppc64':
|
||||||
# ppc64 often fails w/128M lately, and we want at least 1G
|
# ppc64 often fails w/128M lately, and we want at least 1G
|
||||||
# of RAM for normal use, due to 64k page size... :\
|
# of RAM for normal use, due to 64k page size... :\
|
||||||
lowerBound = 256
|
lowerBound = 256
|
||||||
minUsable = 1024
|
minUsable = 1024
|
||||||
|
|
||||||
upperBound = (self.availMem - minUsable) - (self.availMem % step)
|
upperBound = (self.availMem - minUsable) - (self.availMem % step)
|
||||||
|
|
||||||
if upperBound < lowerBound:
|
if upperBound < lowerBound:
|
||||||
self.enoughMem = False
|
self.enoughMem = False
|
||||||
|
|
||||||
# Set spinner to lowerBound unless already set on kernel command line
|
# Set spinner to lowerBound unless already set on kernel command line
|
||||||
if self.kdumpMem == 0:
|
if self.kdumpMem == 0:
|
||||||
self.kdumpMem = lowerBound
|
self.kdumpMem = lowerBound
|
||||||
else:
|
else:
|
||||||
# round down to a multiple of step value
|
# round down to a multiple of step value
|
||||||
self.kdumpMem = self.kdumpMem - (self.kdumpMem % step)
|
self.kdumpMem = self.kdumpMem - (self.kdumpMem % step)
|
||||||
|
|
||||||
# kdump enable/disable checkbox
|
# kdump enable/disable checkbox
|
||||||
self.enableKdumpCheck = gtk.CheckButton("Enable kdump?")
|
self.enableKdumpCheck = gtk.CheckButton("Enable kdump?")
|
||||||
self.enableKdumpCheck.set_alignment(xalign=0, yalign=0)
|
self.enableKdumpCheck.set_alignment(xalign=0, yalign=0)
|
||||||
|
|
||||||
# detected total amount of system memory
|
# detected total amount of system memory
|
||||||
self.totalMem = gtk.Label(_("%s" % self.availMem))
|
self.totalMem = gtk.Label(_("%s" % self.availMem))
|
||||||
self.labelTotal = gtk.Label(_("_Total System Memory (MB):"))
|
self.labelTotal = gtk.Label(_("_Total System Memory (MB):"))
|
||||||
self.labelTotal.set_use_underline(True)
|
self.labelTotal.set_use_underline(True)
|
||||||
self.labelTotal.set_mnemonic_widget(self.totalMem)
|
self.labelTotal.set_mnemonic_widget(self.totalMem)
|
||||||
self.labelTotal.set_alignment(0.0, 0.5)
|
self.labelTotal.set_alignment(0.0, 0.5)
|
||||||
self.labelTotal.set_width_chars(32)
|
self.labelTotal.set_width_chars(32)
|
||||||
|
|
||||||
# how much ram to reserve for kdump
|
# how much ram to reserve for kdump
|
||||||
self.memSpin = gtk.Adjustment(self.kdumpMem, lowerBound, upperBound, step, step, 64)
|
self.memSpin = gtk.Adjustment(self.kdumpMem, lowerBound, upperBound, step, step, 64)
|
||||||
self.kdumpMem = gtk.SpinButton(self.memSpin, 0, 0)
|
self.kdumpMem = gtk.SpinButton(self.memSpin, 0, 0)
|
||||||
self.kdumpMem.set_update_policy(gtk.UPDATE_IF_VALID)
|
self.kdumpMem.set_update_policy(gtk.UPDATE_IF_VALID)
|
||||||
self.kdumpMem.set_numeric(True)
|
self.kdumpMem.set_numeric(True)
|
||||||
self.memSpin.connect("value_changed", self.updateAvail, self.kdumpMem)
|
self.memSpin.connect("value_changed", self.updateAvail, self.kdumpMem)
|
||||||
self.labelKdump = gtk.Label(_("_Kdump Memory (MB):"))
|
self.labelKdump = gtk.Label(_("_Kdump Memory (MB):"))
|
||||||
self.labelKdump.set_use_underline(True)
|
self.labelKdump.set_use_underline(True)
|
||||||
self.labelKdump.set_mnemonic_widget(self.kdumpMem)
|
self.labelKdump.set_mnemonic_widget(self.kdumpMem)
|
||||||
self.labelKdump.set_alignment(0.0, 0.5)
|
self.labelKdump.set_alignment(0.0, 0.5)
|
||||||
|
|
||||||
# remaining usable system memory
|
# remaining usable system memory
|
||||||
self.resMem = eval(string.strip(self.kdumpMem.get_text()))
|
self.resMem = eval(string.strip(self.kdumpMem.get_text()))
|
||||||
self.remMem = self.availMem - self.resMem
|
self.remMem = self.availMem - self.resMem
|
||||||
self.systemUsableMem = gtk.Label(_("%s" % self.remMem))
|
self.systemUsableMem = gtk.Label(_("%s" % self.remMem))
|
||||||
self.labelSys = gtk.Label(_("_Usable System Memory (MB):"))
|
self.labelSys = gtk.Label(_("_Usable System Memory (MB):"))
|
||||||
self.labelSys.set_use_underline(True)
|
self.labelSys.set_use_underline(True)
|
||||||
self.labelSys.set_mnemonic_widget(self.systemUsableMem)
|
self.labelSys.set_mnemonic_widget(self.systemUsableMem)
|
||||||
self.labelSys.set_alignment(0.0, 0.5)
|
self.labelSys.set_alignment(0.0, 0.5)
|
||||||
|
|
||||||
self.vbox = gtk.VBox()
|
self.vbox = gtk.VBox()
|
||||||
self.vbox.set_size_request(400, 200)
|
self.vbox.set_size_request(400, 200)
|
||||||
|
|
||||||
title_pix = functions.imageFromFile("workstation.png")
|
# title_pix = loadPixbuf("workstation.png")
|
||||||
|
|
||||||
internalVBox = gtk.VBox()
|
internalVBox = gtk.VBox()
|
||||||
internalVBox.set_border_width(10)
|
internalVBox.set_border_width(10)
|
||||||
internalVBox.set_spacing(10)
|
internalVBox.set_spacing(10)
|
||||||
|
|
||||||
label = gtk.Label(_("Kdump is a kernel crash dumping mechanism. In the event of a "
|
label = gtk.Label(_("Kdump is a kernel crash dumping mechanism. In the event of a "
|
||||||
"system crash, kdump will capture information from your system "
|
"system crash, kdump will capture information from your system "
|
||||||
"that can be invaluable in determining the cause of the crash. "
|
"that can be invaluable in determining the cause of the crash. "
|
||||||
"Note that kdump does require reserving a portion of system "
|
"Note that kdump does require reserving a portion of system "
|
||||||
"memory that will be unavailable for other uses."))
|
"memory that will be unavailable for other uses."))
|
||||||
|
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
label.set_alignment(0.0, 0.5)
|
label.set_alignment(0.0, 0.5)
|
||||||
label.set_size_request(500, -1)
|
label.set_size_request(500, -1)
|
||||||
internalVBox.pack_start(label, False, True)
|
internalVBox.pack_start(label, False, True)
|
||||||
|
|
||||||
table = gtk.Table(2, 4)
|
table = gtk.Table(2, 4)
|
||||||
|
|
||||||
table.attach(self.enableKdumpCheck, 0, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
|
table.attach(self.enableKdumpCheck, 0, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
table.attach(self.labelTotal, 0, 1, 1, 2, gtk.FILL)
|
table.attach(self.labelTotal, 0, 1, 1, 2, gtk.FILL)
|
||||||
table.attach(self.totalMem, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5, 5)
|
table.attach(self.totalMem, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
table.attach(self.labelKdump, 0, 1, 2, 3, gtk.FILL)
|
table.attach(self.labelKdump, 0, 1, 2, 3, gtk.FILL)
|
||||||
table.attach(self.kdumpMem, 1, 2, 2, 3, gtk.SHRINK, gtk.FILL, 5, 5)
|
table.attach(self.kdumpMem, 1, 2, 2, 3, gtk.SHRINK, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
table.attach(self.labelSys, 0, 1, 3, 4, gtk.FILL)
|
table.attach(self.labelSys, 0, 1, 3, 4, gtk.FILL)
|
||||||
table.attach(self.systemUsableMem, 1, 2, 3, 4, gtk.SHRINK, gtk.FILL, 5, 5)
|
table.attach(self.systemUsableMem, 1, 2, 3, 4, gtk.SHRINK, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
# disable until user clicks check box, if not already enabled
|
# disable until user clicks check box, if not already enabled
|
||||||
if self.initialState is False:
|
if self.initialState is False:
|
||||||
self.showHide(False)
|
self.showHide(False)
|
||||||
else:
|
else:
|
||||||
self.enableKdumpCheck.set_active(True)
|
self.enableKdumpCheck.set_active(True)
|
||||||
|
|
||||||
internalVBox.pack_start(table, True, 15)
|
internalVBox.pack_start(table, True, 15)
|
||||||
|
|
||||||
# toggle sensitivity of Mem items
|
# toggle sensitivity of Mem items
|
||||||
self.enableKdumpCheck.connect("toggled", self.on_enableKdumpCheck_toggled)
|
self.enableKdumpCheck.connect("toggled", self.on_enableKdumpCheck_toggled)
|
||||||
|
|
||||||
self.vbox.pack_start(internalVBox, False, 15)
|
self.vbox.pack_start(internalVBox, False, 15)
|
||||||
|
|
||||||
return self.vbox, title_pix, self.moduleName
|
def grabFocus(self):
|
||||||
|
self.enableKdumpCheck.grab_focus()
|
||||||
|
|
||||||
def grabFocus(self):
|
def apply(self, *args):
|
||||||
self.enableKdumpCheck.grab_focus()
|
if self.kdumpEnabled:
|
||||||
|
totalSysMem = self.totalMem.get_text()
|
||||||
|
totalSysMem = eval(string.strip(totalSysMem))
|
||||||
|
reservedMem = self.kdumpMem.get_value_as_int()
|
||||||
|
remainingMem = totalSysMem - reservedMem
|
||||||
|
else:
|
||||||
|
reservedMem = self.kdumpMemInitial
|
||||||
|
|
||||||
def apply(self, *args):
|
if self.doDebug:
|
||||||
if self.kdumpEnabled:
|
print "Running kernel %s on %s architecture" % (self.runningKernel, self.arch)
|
||||||
totalSysMem = self.totalMem.get_text()
|
if self.enableKdumpCheck.get_active():
|
||||||
totalSysMem = eval(string.strip(totalSysMem))
|
print "System Mem: %s MB Kdump Mem: %s MB Avail Mem: %s MB" % (totalSysMem, reservedMem, remainingMem)
|
||||||
reservedMem = self.kdumpMem.get_value_as_int()
|
else:
|
||||||
remainingMem = totalSysMem - reservedMem
|
print "Kdump will be disabled"
|
||||||
else:
|
|
||||||
reservedMem = self.kdumpMemInitial
|
|
||||||
|
|
||||||
if self.doDebug:
|
# If the user simply doesn't have enough memory for kdump to be viable/supportable, tell 'em
|
||||||
print "Running kernel %s on %s architecture" % (self.runningKernel, self.arch)
|
if self.enoughMem is False and self.kdumpEnabled:
|
||||||
if self.enableKdumpCheck.get_active():
|
self.showErrorMessage(_("Sorry, your system does not have enough memory for kdump to be viable!"))
|
||||||
print "System Mem: %s MB Kdump Mem: %s MB Avail Mem: %s MB" % (totalSysMem, reservedMem, remainingMem)
|
self.enableKdumpCheck.set_active(False)
|
||||||
else:
|
self.showHide(False)
|
||||||
print "Kdump will be disabled"
|
return RESULT_FAILURE
|
||||||
|
# Alert user that we're not going to turn on kdump if they're running a xen kernel
|
||||||
|
elif self.xenKernel != -1 and self.kdumpEnabled:
|
||||||
|
self.showErrorMessage(_("Sorry, Xen kernels do not support kdump at this time!"))
|
||||||
|
self.enableKdumpCheck.set_active(False)
|
||||||
|
self.showHide(False)
|
||||||
|
return RESULT_FAILURE
|
||||||
|
# If there's no kdump support on this arch, let the user know and don't configure
|
||||||
|
elif self.arch in self.unsupportedArches:
|
||||||
|
self.showErrorMessage(_("Sorry, the %s architecture does not support kdump at this time!" % self.arch))
|
||||||
|
self.enableKdumpCheck.set_active(False)
|
||||||
|
self.showHide(False)
|
||||||
|
return RESULT_FAILURE
|
||||||
|
|
||||||
# If the user simply doesn't have enough memory for kdump to be viable/supportable, tell 'em
|
# If running on an arch w/a separate kernel-kdump (i.e., non-relocatable kernel), check to
|
||||||
if self.enoughMem is False and self.kdumpEnabled:
|
# see that its installed, otherwise, alert the user they need to install it, and give them
|
||||||
self.showErrorMessage(_("Sorry, your system does not have enough memory for kdump to be viable!"))
|
# the chance to abort configuration.
|
||||||
self.enableKdumpCheck.set_active(False)
|
if self.arch in self.kernelKdumpArches and self.kernelKdumpInstalled is False:
|
||||||
self.showHide(False)
|
kernelKdumpNote = "\n\nNote that the %s architecture does not feature a relocatable kernel at this time, and thus requires a separate kernel-kdump package to be installed for kdump to function. This can be installed via 'yum install kernel-kdump' at your convenience.\n\n" % self.arch
|
||||||
return 0
|
else:
|
||||||
# Alert user that we're not going to turn on kdump if they're running a xen kernel
|
kernelKdumpNote = ""
|
||||||
elif self.xenKernel != -1 and self.kdumpEnabled:
|
|
||||||
self.showErrorMessage(_("Sorry, Xen kernels do not support kdump at this time!"))
|
|
||||||
self.enableKdumpCheck.set_active(False)
|
|
||||||
self.showHide(False)
|
|
||||||
return 0
|
|
||||||
# If there's no kdump support on this arch, let the user know and don't configure
|
|
||||||
elif self.arch in self.unsupportedArches:
|
|
||||||
self.showErrorMessage(_("Sorry, the %s architecture does not support kdump at this time!" % self.arch))
|
|
||||||
self.enableKdumpCheck.set_active(False)
|
|
||||||
self.showHide(False)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
# If running on an arch w/a separate kernel-kdump (i.e., non-relocatable kernel), check to
|
# Don't alert if nothing has changed
|
||||||
# see that its installed, otherwise, alert the user they need to install it, and give them
|
if self.initialState != self.kdumpEnabled or reservedMem != self.kdumpMemInitial:
|
||||||
# the chance to abort configuration.
|
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO,
|
||||||
if self.arch in self.kernelKdumpArches and self.kernelKdumpInstalled is False:
|
gtk.BUTTONS_YES_NO,
|
||||||
kernelKdumpNote = "\n\nNote that the %s architecture does not feature a relocatable kernel at this time, and thus requires a separate kernel-kdump package to be installed for kdump to function. This can be installed via 'yum install kernel-kdump' at your convenience.\n\n" % self.arch
|
_("Changing Kdump settings requires rebooting the "
|
||||||
else:
|
"system to reallocate memory accordingly. %sWould you "
|
||||||
kernelKdumpNote = ""
|
"like to continue with this change and reboot the "
|
||||||
|
"system after firstboot is complete?" % kernelKdumpNote))
|
||||||
|
dlg.set_position(gtk.WIN_POS_CENTER)
|
||||||
|
dlg.show_all()
|
||||||
|
rc = dlg.run()
|
||||||
|
dlg.destroy()
|
||||||
|
|
||||||
# Don't alert if nothing has changed
|
if rc == gtk.RESPONSE_NO:
|
||||||
if self.initialState != self.kdumpEnabled or reservedMem != self.kdumpMemInitial:
|
self.needsReboot = False
|
||||||
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO,
|
return RESULT_SUCCESS
|
||||||
gtk.BUTTONS_YES_NO,
|
else:
|
||||||
_("Changing Kdump settings requires rebooting the "
|
self.needsReboot = True
|
||||||
"system to reallocate memory accordingly. %sWould you "
|
|
||||||
"like to continue with this change and reboot the "
|
|
||||||
"system after firstboot is complete?" % kernelKdumpNote))
|
|
||||||
dlg.set_position(gtk.WIN_POS_CENTER)
|
|
||||||
dlg.show_all()
|
|
||||||
rc = dlg.run()
|
|
||||||
dlg.destroy()
|
|
||||||
|
|
||||||
if rc == gtk.RESPONSE_NO:
|
# Find bootloader if it exists, and update accordingly
|
||||||
self.needsReboot = False
|
if self.getBootloader() == None:
|
||||||
return None
|
self.showErrorMessage(_("Error! No bootloader config file found, aborting configuration!"))
|
||||||
else:
|
self.enableKdumpCheck.set_active(False)
|
||||||
self.needsReboot = True
|
self.showHide(False)
|
||||||
|
return RESULT_FAILURE
|
||||||
|
else:
|
||||||
|
self.offset = self.bootloaders[self.bootloader][1]
|
||||||
|
|
||||||
# Find bootloader if it exists, and update accordingly
|
# Are we adding or removing the crashkernel param?
|
||||||
if self.getBootloader() == None:
|
if self.kdumpEnabled:
|
||||||
self.showErrorMessage(_("Error! No bootloader config file found, aborting configuration!"))
|
grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --args=crashkernel=%iM@%iM" \
|
||||||
self.enableKdumpCheck.set_active(False)
|
% (self.bootloader, self.runningKernel, reservedMem, self.offset)
|
||||||
self.showHide(False)
|
chkconfigStatus = "on"
|
||||||
return 0
|
else:
|
||||||
else:
|
grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --remove-args=crashkernel=%s" \
|
||||||
self.offset = self.bootloaders[self.bootloader][1]
|
% (self.bootloader, self.runningKernel, self.origCrashKernel)
|
||||||
|
chkconfigStatus = "off"
|
||||||
|
|
||||||
# Are we adding or removing the crashkernel param?
|
if self.doDebug:
|
||||||
if self.kdumpEnabled:
|
print "Using %s bootloader with %iM offset" % (self.bootloader, self.offset)
|
||||||
grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --args=crashkernel=%iM@%iM" \
|
print "Grubby command would be:\n %s" % grubbyCmd
|
||||||
% (self.bootloader, self.runningKernel, reservedMem, self.offset)
|
else:
|
||||||
chkconfigStatus = "on"
|
os.system(grubbyCmd)
|
||||||
else:
|
os.system("/sbin/chkconfig kdump %s" % chkconfigStatus)
|
||||||
grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --remove-args=crashkernel=%s" \
|
if self.bootloader == 'yaboot':
|
||||||
% (self.bootloader, self.runningKernel, self.origCrashKernel)
|
os.system('/sbin/ybin')
|
||||||
chkconfigStatus = "off"
|
else:
|
||||||
|
self.needsReboot = False
|
||||||
if self.doDebug:
|
|
||||||
print "Using %s bootloader with %iM offset" % (self.bootloader, self.offset)
|
|
||||||
print "Grubby command would be:\n %s" % grubbyCmd
|
|
||||||
else:
|
|
||||||
os.system(grubbyCmd)
|
|
||||||
os.system("/sbin/chkconfig kdump %s" % chkconfigStatus)
|
|
||||||
if self.bootloader == 'yaboot':
|
|
||||||
os.system('/sbin/ybin')
|
|
||||||
else:
|
|
||||||
self.needsReboot = False
|
|
||||||
|
|
||||||
|
|
||||||
return 0
|
return RESULT_SUCCESS
|
||||||
|
|
||||||
|
def showErrorMessage(self, text):
|
||||||
|
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
|
||||||
|
dlg.set_position(gtk.WIN_POS_CENTER)
|
||||||
|
dlg.set_modal(True)
|
||||||
|
rc = dlg.run()
|
||||||
|
dlg.destroy()
|
||||||
|
return None
|
||||||
|
|
||||||
|
def initializeUI(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def showErrorMessage(self, text):
|
|
||||||
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
|
|
||||||
dlg.set_position(gtk.WIN_POS_CENTER)
|
|
||||||
dlg.set_modal(True)
|
|
||||||
rc = dlg.run()
|
|
||||||
dlg.destroy()
|
|
||||||
return None
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 2.0.0
|
Version: 2.0.0
|
||||||
Release: 15%{?dist}
|
Release: 16%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Summary: The kexec/kdump userspace component.
|
Summary: The kexec/kdump userspace component.
|
||||||
@ -256,6 +256,9 @@ done
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 23 2009 Neil Horman <nhorman@redhat.com> 2.0.0-16
|
||||||
|
- Fix up kdump so it works with latest firstboot
|
||||||
|
|
||||||
* Mon Jun 15 2009 Neil Horman <nhorman@redhat.com> 2.0.0-15
|
* Mon Jun 15 2009 Neil Horman <nhorman@redhat.com> 2.0.0-15
|
||||||
- Fixed some stat drive detect bugs by E. Biederman (bz505701)
|
- Fixed some stat drive detect bugs by E. Biederman (bz505701)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user