ab224c
#
ab224c
# firstboot_kdump.py - kdump configuration page for firstboot
ab224c
# Copyright 2006 Red Hat, Inc.
ab224c
# Author: Jarod Wilson <jwilson@redhat.com>
ab224c
# Contributors:
ab224c
#	 Neil Horman <nhorman@redhat.com>
ab224c
#	 Dave Lehman <dlehman@redhat.com>
ab224c
#
ab224c
#
ab224c
# This program is free software; you can redistribute it and/or modify
ab224c
# it under the terms of the GNU General Public License as published by
ab224c
# the Free Software Foundation; either version 2 of the License, or
ab224c
# (at your option) any later version.
ab224c
#
ab224c
# This program is distributed in the hope that it will be useful,
ab224c
# but WITHOUT ANY WARRANTY; without even the implied warranty of
ab224c
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ab224c
# GNU General Public License for more details.
ab224c
#
ab224c
# You should have received a copy of the GNU General Public License
ab224c
# along with this program; if not, write to the Free Software
ab224c
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ab224c
ab224c
import sys
ab224c
sys.path.append('/usr/share/system-config-kdump/')
ab224c
ab224c
from gtk import *
ab224c
import string
ab224c
import os
ab224c
import os.path
ab224c
import time
ab224c
import gtk
ab224c
import gobject
ab224c
import commands
ab224c
from firstboot.config import *
ab224c
from firstboot.constants import *
ab224c
from firstboot.functions import *
ab224c
from firstboot.module import *
ab224c
import gettext
ab224c
_ = lambda x: gettext.ldgettext("kexec-tools", x)
ab224c
N_ = lambda x: x
ab224c
ab224c
class moduleClass(Module):
ab224c
	def __init__(self):
ab224c
		Module.__init__(self)
ab224c
		self.priority = 100
ab224c
		self.sidebarTitle = N_("Kdump")
ab224c
		self.title = N_("Kdump")
ab224c
		self.reboot = False
ab224c
ab224c
	# runPriority determines the order in which this module runs in firstboot
ab224c
	runPriority = 70
ab224c
	moduleName = _("Kdump")
ab224c
	windowName = moduleName
ab224c
	reboot = False
ab224c
ab224c
	# possible bootloaders we'll need to adjust
ab224c
	#			 bootloader : (config file, kdump offset)
ab224c
	bootloaders = { "grub"   : (["/boot/grub/grub.conf", \
929c78
				"/boot/efi/EFI/redhat/grub.conf"], [16, 256]),\
ab224c
			"grub2"   : (["/boot/grub2/grub.cfg", \
ab224c
				"/boot/efi/EFI/fedora/grub.cfg", \
929c78
				"/boot/efi/EFI/redhat/grub.cfg"], [16, 256]),\
ab224c
			"zipl" : (["/etc/zipl.conf"], [0]),\
ab224c
			"yaboot" : (["/boot/etc/yaboot.conf"], [32]) }
ab224c
	bootloader = None
ab224c
	offset = 0
ab224c
ab224c
	# list of architectures without kdump support
ab224c
	unsupportedArches = [ "ppc", "s390", "i386", "i586" ]
ab224c
ab224c
	def needsReboot(self):
ab224c
		return self.reboot
ab224c
ab224c
	# toggle sensitivity of kdump config bits
ab224c
	def showHideReserve(self, status):
ab224c
		self.labelKdump.set_sensitive(status)
ab224c
		self.kdumpMemspin.set_sensitive(status)
ab224c
		self.totalMem.set_sensitive(status)
ab224c
		self.systemUsableMem.set_sensitive(status)
ab224c
		self.labelTotal.set_sensitive(status)
ab224c
		self.labelSys.set_sensitive(status)
ab224c
ab224c
	# toggle sensitivity of kdump config bits
ab224c
	def showHide(self, status):
ab224c
		show_kdumpmem = status
ab224c
		if self.distro == 'rhel':
ab224c
			show_autoreserve = self.buttonAuto.get_active()
ab224c
			if status == True:
ab224c
				if self.buttonAuto.get_active() == True:
ab224c
					show_kdumpmem = False
ab224c
			self.buttonAuto.set_active(show_autoreserve)
ab224c
			self.buttonManual.set_active(not show_autoreserve)
ab224c
			self.labelReserve.set_sensitive(status)
ab224c
			self.buttonAuto.set_sensitive(status)
ab224c
			self.buttonManual.set_sensitive(status)
ab224c
		self.showHideReserve(show_kdumpmem)
ab224c
		self.labelReserved.set_sensitive(status)
ab224c
		self.labelReservedMemsize.set_sensitive(status)
ab224c
		self.kdumpEnabled = status
ab224c
		self.AdvWindow.set_sensitive(status)
ab224c
ab224c
	def on_enableKdumpCheck_toggled(self, *args):
ab224c
		showHideStatus = self.enableKdumpCheck.get_active()
ab224c
		self.showHide(showHideStatus)
ab224c
ab224c
	def on_auto_toggled(self, *args):
ab224c
		if self.distro == 'rhel':
ab224c
			self.showHideReserve(not self.buttonAuto.get_active())
ab224c
ab224c
	def on_manual_toggled(self, *args):
ab224c
		if self.distro == 'rhel':
ab224c
			self.showHideReserve(self.buttonManual.get_active())
ab224c
ab224c
	def updateAvail(self, widget, spin):
ab224c
		self.reserveMem = eval(string.strip(self.kdumpMemspin.get_text()))
ab224c
		self.remainingMem = self.availMem - self.reserveMem
ab224c
		self.systemUsableMem.set_text("%s" % self.remainingMem)
ab224c
ab224c
	def getBootloader(self):
ab224c
		for (name, (conf, offset)) in self.bootloaders.items():
ab224c
			i = 0
ab224c
			for c in conf:
ab224c
				if os.access(c, os.W_OK):
ab224c
					self.bootloader = name
ab224c
					self.offset = i
ab224c
					return self.bootloader
ab224c
				i += 1
ab224c
ab224c
		self.offset = None
ab224c
		self.bootloader = None
ab224c
		return None
ab224c
ab224c
	def createScreen(self, doDebug = None):
ab224c
		self.doDebug = doDebug
ab224c
ab224c
		if doDebug:
ab224c
			print "initializing kdump module"
ab224c
ab224c
		# What kernel are we running?
ab224c
		self.runningKernel = os.popen("/bin/uname -r").read().strip()
ab224c
ab224c
		# What arch are we running on?
ab224c
		self.arch = os.popen("/bin/uname -m").read().strip()
ab224c
ab224c
		# Check for a xen kernel, kdump doesn't work w/xen just yet...
ab224c
		self.xenKernel = self.runningKernel.find("xen")
ab224c
ab224c
		# Fedora or RHEL?
ab224c
		releaseFile = '/etc/redhat-release'
ab224c
		lines = open(releaseFile).readlines()
ab224c
		for line in lines:
ab224c
			if line.find("Fedora") != -1:
ab224c
				self.distro = 'fedora'
ab224c
			else:
ab224c
				self.distro = 'rhel'
ab224c
ab224c
		# Ascertain how much memory is in the system
ab224c
		memInfo = open("/proc/meminfo").readlines()
ab224c
		self.availMem = 0
ab224c
		for line in memInfo:
ab224c
				if line.startswith("MemTotal:"):
ab224c
					self.availMem = int(line.split()[1]) / 1024
ab224c
					break
ab224c
ab224c
		# Fix up memory calculations if kdump is already on
ab224c
		cmdLine = open("/proc/cmdline").read()
ab224c
		self.kdumpOffset = 0
ab224c
		self.origCrashKernel = ""
ab224c
		self.kdumpEnabled = False
ab224c
		chkConfigStatus=commands.getoutput('/bin/systemctl is-enabled kdump.service')
ab224c
		if chkConfigStatus.find("enabled") > -1:
ab224c
			self.kdumpEnabled = True
ab224c
		self.kdumpMemInitial = 0
ab224c
ab224c
		crashString = ""
ab224c
		kexec_crash_size = open("/sys/kernel/kexec_crash_size").read()
ab224c
		self.reservedMem = int(kexec_crash_size)/(1024*1024)
ab224c
ab224c
		if cmdLine.find("crashkernel") != -1:
ab224c
			crashString = filter(lambda t: t.startswith("crashkernel="),
ab224c
					 cmdLine.split())[0].split("=")[1]
ab224c
			self.origCrashKernel = "crashkernel=%s" % (crashString)
ab224c
			if self.doDebug:
ab224c
				print "crashString is %s" % crashString
ab224c
			if crashString.find("@") != -1:
ab224c
				(self.kdumpMemInitial, self.kdumpOffset) = [int(m[:-1]) for m in crashString.split("@")]
ab224c
			else:
ab224c
				#kdumpMemInitial = -1 means auto reservation
ab224c
				if self.distro == 'rhel' and self.origCrashKernel == 'crashkernel=auto':
ab224c
					self.kdumpMemInitial=-1
ab224c
				else:
ab224c
					self.kdumpMemInitial=int(crashString[:-1])
ab224c
				self.kdumpOffset = 0
ab224c
		if self.kdumpMemInitial != 0:
ab224c
			self.availMem += self.reservedMem
ab224c
			self.kdumpEnabled = True
ab224c
		else:
ab224c
			self.kdumpEnabled = False
ab224c
			if self.origCrashKernel.find("crashkernel=") != -1:
ab224c
				self.kdumpEnabled = True
ab224c
ab224c
		self.initialState = self.kdumpEnabled
ab224c
ab224c
		# Do some sanity-checking and try to present only sane options.
ab224c
		#
ab224c
		# Defaults
ab224c
		lowerBound = 128
ab224c
		minUsable = 256
ab224c
		step = 1
ab224c
		self.enoughMem = True
ab224c
		if self.arch == 'ia64':
ab224c
			# ia64 usually needs at *least* 256M, page-aligned... :(
ab224c
			lowerBound = 256
ab224c
			minUsable = 512
ab224c
			step = 256
ab224c
		elif self.arch == 'ppc64':
ab224c
			# ppc64 often fails w/128M lately, and we want at least 1G
ab224c
			# of RAM for normal use, due to 64k page size... :\
ab224c
			lowerBound = 256
ab224c
			minUsable = 1024
ab224c
ab224c
		upperBound = (self.availMem - minUsable) - (self.availMem % step)
ab224c
ab224c
		if upperBound < lowerBound:
ab224c
			self.enoughMem = False
ab224c
ab224c
		# Set spinner to lowerBound unless already set on kernel command line
ab224c
		if self.kdumpMemInitial == 0 or  self.kdumpMemInitial == -1:
ab224c
			self.kdumpMemInitial = lowerBound
ab224c
		else:
ab224c
			# round down to a multiple of step value
ab224c
			self.kdumpMemInitial = self.kdumpMemInitial - (self.kdumpMemInitial % step)
ab224c
ab224c
		# kdump enable/disable checkbox
ab224c
		self.enableKdumpCheck = gtk.CheckButton(_("_Enable kdump?"))
ab224c
		self.enableKdumpCheck.set_alignment(xalign=0, yalign=0)
ab224c
ab224c
		# detected total amount of system memory
ab224c
		self.totalMem = gtk.Label(_("%s" % self.availMem))
ab224c
		self.labelTotal = gtk.Label(_("Total System Memory (MB):"))
ab224c
		self.labelTotal.set_alignment(0.0, 0.5)
ab224c
		self.labelTotal.set_width_chars(32)
ab224c
ab224c
		# how much ram to reserve for kdump
ab224c
		self.memAdjustment = gtk.Adjustment(self.kdumpMemInitial, lowerBound, upperBound, step, step, 0)
ab224c
		self.kdumpMemspin = gtk.SpinButton(self.memAdjustment, 0, 0)
ab224c
		self.kdumpMemspin.set_update_policy(gtk.UPDATE_IF_VALID)
ab224c
		self.kdumpMemspin.set_numeric(True)
ab224c
		self.memAdjustment.connect("value_changed", self.updateAvail, self.kdumpMemspin)
ab224c
		self.labelKdump = gtk.Label(_("Memory To Be _Reserved (MB):"))
ab224c
		self.labelKdump.set_use_underline(True)
ab224c
		self.labelKdump.set_mnemonic_widget(self.kdumpMemspin)
ab224c
		self.labelKdump.set_alignment(0.0, 0.5)
ab224c
ab224c
		# remaining usable system memory
ab224c
		self.reserveMem = eval(string.strip(self.kdumpMemspin.get_text()))
ab224c
		self.remainingMem = self.availMem - self.reserveMem
ab224c
		self.systemUsableMem = gtk.Label(_("%s" % self.remainingMem))
ab224c
		self.labelSys = gtk.Label(_("Usable System Memory (MB):"))
ab224c
		self.labelSys.set_alignment(0.0, 0.5)
ab224c
ab224c
		self.labelReserved=gtk.Label(_("Memory Currently Reserved (MB):"))
ab224c
		self.labelReservedMemsize=gtk.Label(_("%s" % self.reservedMem))
ab224c
		self.labelReserved.set_alignment(0.0, 0.5)
ab224c
ab224c
		# rhel crashkernel=auto handling
ab224c
		if self.distro == 'rhel':
ab224c
			self.labelReserve = gtk.Label(_("Kdump Memory Reservation:"))
ab224c
			self.buttonAuto = gtk.RadioButton(None, _("_Automatic"))
ab224c
			self.buttonManual = gtk.RadioButton(self.buttonAuto, _("_Manual"))
ab224c
			self.buttonAuto.connect("toggled", self.on_auto_toggled, None)
ab224c
			self.buttonManual.connect("toggled", self.on_manual_toggled, None)
ab224c
			self.buttonAuto.set_use_underline(True)
ab224c
			self.buttonManual.set_use_underline(True)
ab224c
			self.labelReserve.set_alignment(0.0, 0.5)
ab224c
			if self.origCrashKernel == 'crashkernel=auto':
ab224c
				self.buttonAuto.set_active(True)
ab224c
				self.buttonManual.set_active(False)
ab224c
			else:
ab224c
				self.buttonAuto.set_active(False)
ab224c
				self.buttonManual.set_active(True)
ab224c
			self.autoinitial = self.buttonAuto.get_active()
ab224c
ab224c
ab224c
		# Add an advanced kdump config text widget
ab224c
		inputbuf = open("/etc/kdump.conf", "r")
ab224c
		self.AdvConfig = gtk.TextView()
ab224c
		AdvBuf = gtk.TextBuffer()
ab224c
		AdvBuf.set_text(inputbuf.read())
ab224c
		inputbuf.close()
ab224c
ab224c
		self.AdvConfig.set_buffer(AdvBuf)
ab224c
		self.AdvWindow = gtk.ScrolledWindow()
ab224c
		self.AdvWindow.set_shadow_type(gtk.SHADOW_IN)
ab224c
		self.AdvWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
ab224c
		self.AdvWindow.set_size_request(500, 300)
ab224c
		self.AdvWindow.add(self.AdvConfig)
ab224c
ab224c
		self.AdvConfLabel = gtk.Label(_("\nAdvanced kdump configuration"))
ab224c
		self.AdvConfLabel.set_alignment(0.0, 0.5)
ab224c
ab224c
		self.vbox = gtk.VBox()
ab224c
		self.vbox.set_size_request(400, 200)
ab224c
ab224c
		# title_pix = loadPixbuf("workstation.png")
ab224c
ab224c
		internalVBox = gtk.VBox()
ab224c
		internalVBox.set_border_width(10)
ab224c
		internalVBox.set_spacing(10)
ab224c
ab224c
		label = gtk.Label(_("Kdump is a kernel crash dumping mechanism. In the event of a "
ab224c
							"system crash, kdump will capture information from your system "
ab224c
							"that can be invaluable in determining the cause of the crash. "
ab224c
							"Note that kdump does require reserving a portion of system "
ab224c
							"memory that will be unavailable for other uses."))
ab224c
ab224c
		label.set_line_wrap(True)
ab224c
		label.set_alignment(0.0, 0.5)
ab224c
		label.set_size_request(500, -1)
ab224c
		internalVBox.pack_start(label, False, True)
ab224c
ab224c
		if self.distro == 'rhel':
ab224c
			table = gtk.Table(3, 100)
ab224c
			table.attach(self.enableKdumpCheck, 0, 3, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
ab224c
			table.attach(self.labelReserve, 0, 1, 1, 2, gtk.FILL)
ab224c
			table.attach(self.buttonAuto, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
ab224c
			table.attach(self.buttonManual, 2, 3, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
ab224c
			table.attach(self.labelReserved, 0, 1, 2, 3, gtk.FILL)
ab224c
			table.attach(self.labelReservedMemsize, 2, 3, 2, 3, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
			table.attach(self.labelKdump, 0, 1, 3, 4, gtk.FILL)
ab224c
			table.attach(self.kdumpMemspin, 2, 3, 3, 4, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
			table.attach(self.labelTotal, 0, 1, 4, 5, gtk.FILL)
ab224c
			table.attach(self.totalMem, 2, 3, 4, 5, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
			table.attach(self.labelSys, 0, 1, 5, 6, gtk.FILL)
ab224c
			table.attach(self.systemUsableMem, 2, 3, 5, 6, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
			table.attach(self.AdvConfLabel, 0, 1, 6, 7, gtk.FILL)
ab224c
			table.attach(self.AdvWindow, 0, 3, 7, 100, gtk.FILL, gtk.FILL, 5, 5)
ab224c
		else:
ab224c
			table = gtk.Table(2, 100)
ab224c
			table.attach(self.enableKdumpCheck, 0, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
ab224c
			table.attach(self.labelTotal, 0, 1, 1, 2, gtk.FILL)
ab224c
			table.attach(self.totalMem, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
ab224c
			table.attach(self.labelKdump, 0, 1, 2, 3, gtk.FILL)
ab224c
			table.attach(self.kdumpMemspin, 1, 2, 2, 3, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
ab224c
			table.attach(self.labelReserved, 0, 1, 3, 4, gtk.FILL)
ab224c
			table.attach(self.labelReservedMemsize, 1, 2, 3, 4, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
ab224c
			table.attach(self.labelSys, 0, 1, 4, 5, gtk.FILL)
ab224c
			table.attach(self.systemUsableMem, 1, 2, 4, 5, gtk.SHRINK, gtk.FILL, 5, 5)
ab224c
ab224c
			table.attach(self.AdvConfLabel, 0, 1, 6, 7, gtk.FILL)
ab224c
			table.attach(self.AdvWindow, 0, 2, 7, 100, gtk.FILL, gtk.FILL, 5, 5)
ab224c
ab224c
		# disable until user clicks check box, if not already enabled
ab224c
		if self.initialState is False:
ab224c
			self.showHide(False)
ab224c
		else:
ab224c
			self.enableKdumpCheck.set_active(True)
ab224c
			self.showHide(True)
ab224c
ab224c
		internalVBox.pack_start(table, True, 15)
ab224c
ab224c
		# toggle sensitivity of Mem items
ab224c
		self.enableKdumpCheck.connect("toggled", self.on_enableKdumpCheck_toggled)
ab224c
ab224c
		self.vbox.pack_start(internalVBox, False, 15)
ab224c
ab224c
	def grabFocus(self):
ab224c
		self.enableKdumpCheck.grab_focus()
ab224c
ab224c
	def configChanged(self):
ab224c
		if self.initialState == self.kdumpEnabled and self.initialState == False:
ab224c
			return False
ab224c
		if self.initialState != self.kdumpEnabled \
ab224c
		or (self.distro == 'rhel' and self.autoinitial != self.buttonAuto.get_active()) \
ab224c
		or (self.distro == 'rhel' and self.buttonManual.get_active() == True and self.reserveMem != self.kdumpMemInitial) \
ab224c
		or (self.distro != 'rhel' and self.reserveMem != self.kdumpMemInitial):
ab224c
			return True
ab224c
		return False
ab224c
ab224c
ab224c
	def apply(self, *args):
ab224c
		if self.kdumpEnabled:
ab224c
			self.reserveMem = self.kdumpMemspin.get_value_as_int()
ab224c
		else:
ab224c
			self.reserveMem = self.kdumpMemInitial
ab224c
		self.remainingMem = self.availMem - self.reserveMem
ab224c
		if self.doDebug:
ab224c
			print "Running kernel %s on %s architecture" % (self.runningKernel, self.arch)
ab224c
			if self.enableKdumpCheck.get_active():
ab224c
				print "System Mem: %s MB	Kdump Mem: %s MB	Avail Mem: %s MB" % (totalSysMem, self.reserveMem, self.remainingMem)
ab224c
			else:
ab224c
				print "Kdump will be disabled"
ab224c
ab224c
		# Before we do other checks we should save the users config
ab224c
		AdvBuf = self.AdvConfig.get_buffer()
ab224c
		start, end = AdvBuf.get_bounds()
ab224c
		outputbuf = open("/etc/kdump.conf", "rw+")
ab224c
		outputbuf.write(AdvBuf.get_text(start, end))
ab224c
		outputbuf.close()
ab224c
ab224c
		# Regardless of what else happens we need to be sure to disalbe kdump if its disabled here, or
ab224c
		# else it will fail during startup
ab224c
		if (self.enableKdumpCheck.get_active() == False):
ab224c
			os.system("/bin/systemctl disable kdump.service")
ab224c
ab224c
		# If the user simply doesn't have enough memory for kdump to be viable/supportable, tell 'em
ab224c
		if self.enoughMem is False and self.kdumpEnabled:
ab224c
			self.showErrorMessage(_("Sorry, your system does not have enough memory for kdump to be viable!"))
ab224c
			self.enableKdumpCheck.set_active(False)
ab224c
			self.showHide(False)
ab224c
			return RESULT_FAILURE 
ab224c
		# Alert user that we're not going to turn on kdump if they're running a xen kernel
ab224c
		elif self.xenKernel != -1 and self.kdumpEnabled:
ab224c
			self.showErrorMessage(_("Sorry, Xen kernels do not support kdump at this time!"))
ab224c
			self.enableKdumpCheck.set_active(False)
ab224c
			self.showHide(False)
ab224c
			return RESULT_FAILURE 
ab224c
		# If there's no kdump support on this arch, let the user know and don't configure
ab224c
		elif self.arch in self.unsupportedArches:
ab224c
			self.showErrorMessage(_("Sorry, the %s architecture does not support kdump at this time!" % self.arch))
ab224c
			self.enableKdumpCheck.set_active(False)
ab224c
			self.showHide(False)
ab224c
			return RESULT_FAILURE 
ab224c
ab224c
		# Don't alert if nothing has changed
ab224c
		if self.configChanged() == True:
ab224c
			dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO,
ab224c
									gtk.BUTTONS_YES_NO,
ab224c
									_("Changing Kdump settings requires rebooting the "
ab224c
									  "system to reallocate memory accordingly. Would you "
ab224c
									  "like to continue with this change and reboot the "
ab224c
									  "system after firstboot is complete?"))
ab224c
			dlg.set_position(gtk.WIN_POS_CENTER)
ab224c
			dlg.show_all()
ab224c
			rc = dlg.run()
ab224c
			dlg.destroy()
ab224c
ab224c
			if rc != gtk.RESPONSE_YES:
ab224c
				self.reboot = False
ab224c
				return RESULT_SUCCESS 
ab224c
			else:
ab224c
				self.reboot = True
ab224c
ab224c
				# Find bootloader if it exists, and update accordingly
ab224c
				if self.getBootloader() == None:
ab224c
					self.showErrorMessage(_("Error! No bootloader config file found, aborting configuration!"))
ab224c
					self.enableKdumpCheck.set_active(False)
ab224c
					self.showHide(False)
ab224c
					return RESULT_FAILURE 
ab224c
ab224c
				# Are we adding or removing the crashkernel param?
ab224c
				if self.kdumpEnabled:
ab224c
					_reserves = "%iM" % (self.reserveMem)
ab224c
					if self.distro == 'rhel':
ab224c
						if self.buttonAuto.get_active() == True:
ab224c
							_reserves = 'auto'
ab224c
ab224c
					grubbyCmd = "/sbin/grubby --%s --update-kernel=ALL --args=crashkernel=%s" \
ab224c
								% (self.bootloader, _reserves)
ab224c
					chkconfigStatus = "enable"
ab224c
				else:
ab224c
					grubbyCmd = "/sbin/grubby --%s --update-kernel=ALL --remove-args=%s" \
ab224c
								% (self.bootloader, self.origCrashKernel)
ab224c
					chkconfigStatus = "disable"
ab224c
ab224c
				if self.doDebug:
ab224c
					print "Using %s bootloader with %iM offset" % (self.bootloader, self.offset)
ab224c
					print "Grubby command would be:\n	%s" % grubbyCmd
ab224c
					print "chkconfig status is %s" % chkconfigStatus
ab224c
				else:
ab224c
					os.system(grubbyCmd)
ab224c
					os.system("/bin/systemctl %s kdump.service" % (chkconfigStatus))
ab224c
					if self.bootloader == 'yaboot':
ab224c
						os.system('/sbin/ybin')
ab224c
					if self.bootloader == 'zipl':
ab224c
						os.system('/sbin/zipl')
ab224c
		else:
ab224c
			self.reboot = False
ab224c
ab224c
ab224c
		return RESULT_SUCCESS
ab224c
ab224c
	def showErrorMessage(self, text):
ab224c
		dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
ab224c
		dlg.set_position(gtk.WIN_POS_CENTER)
ab224c
		dlg.set_modal(True)
ab224c
		rc = dlg.run()
ab224c
		dlg.destroy()
ab224c
		return None
ab224c
ab224c
	def initializeUI(self):
ab224c
		pass
ab224c