Configure kdump in firstboot

Resolves: bz805782
Make kdump configurable in firstboot

Add an advanced kdump config text widget, so user can configure
kdump.conf in firstboot,
[update]:
-add changelog
-remove unused variable

Port below patch from rhel:
commit e5ac50339e73b11cd9d5ba91712c43cce7ffcbcb
Author: amwang <amwang@redhat.com>
Date:   Thu Mar 17 09:18:13 2011 +0000

    Resolves: bug 598064.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Dave Young 2012-08-09 10:22:49 +08:00
parent 752aaaa48c
commit 4020f959c1

View File

@ -81,6 +81,7 @@ class moduleClass(Module):
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
self.AdvWindow.set_sensitive(status)
def on_enableKdumpCheck_toggled(self, *args): def on_enableKdumpCheck_toggled(self, *args):
showHideStatus = self.enableKdumpCheck.get_active() showHideStatus = self.enableKdumpCheck.get_active()
@ -234,6 +235,23 @@ class moduleClass(Module):
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)
# Add an advanced kdump config text widget
inputbuf = open("/etc/kdump.conf", "r")
self.AdvConfig = gtk.TextView()
AdvBuf = gtk.TextBuffer()
AdvBuf.set_text(inputbuf.read())
inputbuf.close()
self.AdvConfig.set_buffer(AdvBuf)
self.AdvWindow = gtk.ScrolledWindow()
self.AdvWindow.set_shadow_type(gtk.SHADOW_IN)
self.AdvWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.AdvWindow.set_size_request(500, 300)
self.AdvWindow.add(self.AdvConfig)
self.AdvConfLabel = gtk.Label(_("\nAdvanced kdump configuration"))
self.AdvConfLabel.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)
@ -254,7 +272,7 @@ class moduleClass(Module):
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, 100)
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)
@ -267,6 +285,9 @@ class moduleClass(Module):
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)
table.attach(self.AdvConfLabel, 0, 1, 5, 6, gtk.FILL)
table.attach(self.AdvWindow, 0, 2, 6, 100, gtk.FILL, 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)
@ -299,6 +320,13 @@ class moduleClass(Module):
else: else:
print "Kdump will be disabled" print "Kdump will be disabled"
# Before we do other checks we should save the users config
AdvBuf = self.AdvConfig.get_buffer()
start, end = AdvBuf.get_bounds()
outputbuf = open("/etc/kdump.conf", "rw+")
outputbuf.write(AdvBuf.get_text(start, end))
outputbuf.close()
# Regardless of what else happens we need to be sure to disalbe kdump if its disabled here, or # Regardless of what else happens we need to be sure to disalbe kdump if its disabled here, or
# else it will fail during startup # else it will fail during startup
if (self.enableKdumpCheck.get_active() == False): if (self.enableKdumpCheck.get_active() == False):