Author: juhliarik Date: Mon Aug 6 10:49:29 2007 New Revision: 39969 URL: http://svn.opensuse.org/viewcvs/yast?rev=39969&view=rev Log: added handling of crashkernel param Modified: trunk/kdump/src/Kdump.ycp trunk/kdump/src/complex.ycp trunk/kdump/src/dialogs.ycp trunk/kdump/src/uifunctions.ycp Modified: trunk/kdump/src/Kdump.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/Kdump.ycp?rev=39969&r1=39968&r2=39969&view=diff ============================================================================== --- trunk/kdump/src/Kdump.ycp (original) +++ trunk/kdump/src/Kdump.ycp Mon Aug 6 10:49:29 2007 @@ -43,6 +43,9 @@ import "Storage"; import "Map"; import "Bootloader"; +import "Service"; +import "Popup"; +import "Arch"; /** * Prototypes @@ -91,6 +94,30 @@ */ global boolean crashkernel_param = false; +/** + * String option indicates value of kernel parameter + * "crashkernel" + * + * string value of kernel parameter + */ +global string crashkernel_param_value = ""; + +/** + * Boolean option indicates add kernel param + * "crashkernel" + * + * boolean true if kernel parameter will be add + */ +global boolean add_crashkernel_param = false; + + +/** + * String option for alocate of memory for boot param + * "crashkernel" + * + * string value number of alocate memory + */ +global string alocated_memory = "128"; /** * Write only, used during autoinstallation. @@ -233,11 +260,14 @@ boolean ReadKdumpKernelParam () { string result = Bootloader::getKernelParam (Bootloader::getDefaultSection (), "crashkernel"); - if (result == "true") { - crashkernel_param = true; - } else { + if (result == "false") { crashkernel_param = false; + } else { + crashkernel_param = true; } + + crashkernel_param_value = result; + return true; } @@ -316,6 +346,44 @@ /** + * Write kdump boot argument crashkernel + * set kernel-kdump start at boot + * + * @return boolean successfull + */ +boolean WriteKdumpBootParameter () { + + boolean result = true; + if (add_crashkernel_param) { + string crash_value = ""; + crash_value = alocated_memory+"@"; + if ((Arch::i386()) ||(Arch::x86_64())) { + crash_value = crash_value + "16M"; + } else if (Arch::ia64()) { + crash_value = crash_value + "0"; + } else if (Arch::ppc64()) { + crash_value = crash_value + "32M"; + } else { + Popup::Error("Unsupported architecture, \"crashkernel\" was not added"); + return false; + } + + if ((!crashkernel_param) || (crash_value != crashkernel_param_value)) { + result = Bootloader::setKernelParam (Bootloader::getDefaultSection (), "crashkernel", crash_value); + Popup::Message("For applying changes is necessary reboot."); + } + //start kernel-kdump at boot + Service::Enable("kernel-kdump"); + } else { + + Service::Disable("kernel-kdump"); + } + return true; +} + + + +/** * Read all kdump settings * @return true on success */ @@ -431,7 +499,7 @@ if(Abort()) return false; Progress::NextStage (); /* Error message */ - if(false) Report::Error (Message::SuSEConfigFailed()); + if(!WriteKdumpBootParameter ()) Report::Error (_("Adding crashkernel parameter to bootloader fault.")); sleep(sl); if(Abort()) return false; Modified: trunk/kdump/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/complex.ycp?rev=39969&r1=39968&r2=39969&view=diff ============================================================================== --- trunk/kdump/src/complex.ycp (original) +++ trunk/kdump/src/complex.ycp Mon Aug 6 10:49:29 2007 @@ -37,7 +37,7 @@ import "Wizard_hw"; import "Confirm"; import "Kdump"; - +import "Package"; include "kdump/helps.ycp"; @@ -62,9 +62,61 @@ * @return `abort if aborted and `next otherwise */ symbol ReadDialog() { - Wizard::RestoreHelp(HELPS["read"]:""); - // Kdump::AbortFunction = PollAbort; - if (!Confirm::MustBeRoot()) return `abort; + boolean kexec_installed = false; + boolean kdump_installed = false; + boolean kexec_available = false; + boolean kdump_available = false; + list <string> package_list = []; + + Wizard::RestoreHelp(HELPS["read"]:""); + // Kdump::AbortFunction = PollAbort; + if (!Confirm::MustBeRoot()) return `abort; + + //checking of installation packages + if (Package::Installed("kexec-tools")) { + kexec_installed = true; + } + + if (Package::Installed("kernel-kdump")) { + kdump_installed =true; + } + //checking if packages are available + if ((!kexec_installed) || (!kdump_installed)) { + if (!kexec_installed) + kexec_available = Package::Available("kexec-tools"); + if (!kdump_installed) + kdump_available = Package::Available("kernel-kdump"); + + if ((!kexec_installed) &&(!kexec_available)) { + Popup::Error("Package for kexec-tools is not available."); + y2error("[kdump] (ReadDialog ()) Packages for kexec-tools is not available."); + return `abort; + } + + if ((!kdump_installed) &&(!kdump_available)) { + Popup::Error("Package for kernel-kdump is not available."); + y2error("[kdump] (ReadDialog ()) Packages for kernel-kdump is not available."); + return `abort; + } + + //add packages for installation + if (!kexec_installed) + package_list = add(package_list, "kexec-tools"); + + if (!kdump_installed) + package_list = add(package_list, "kernel-kdump"); + + //install packages + if (!Package::DoInstall(package_list)) { + Popup::Error("Installation failed!"); + y2error("[kdump] Installation of package list %1 failed", package_list); + return `abort; + } + + } + + + boolean ret = Kdump::Read(); return ret ? `next : `abort; } Modified: trunk/kdump/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/dialogs.ycp?rev=39969&r1=39968&r2=39969&view=diff ============================================================================== --- trunk/kdump/src/dialogs.ycp (original) +++ trunk/kdump/src/dialogs.ycp Mon Aug 6 10:49:29 2007 @@ -93,7 +93,7 @@ )), "init" : InitKdumpMemory, "handle" : HandleKdumpMemory, - //"store" : + "store" : StoreKdumpMemory, "help" : HelpKdump("KdumpMemory"), ], Modified: trunk/kdump/src/uifunctions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/uifunctions.ycp?rev=39969&r1=39968&r2=39969&view=diff ============================================================================== --- trunk/kdump/src/uifunctions.ycp (original) +++ trunk/kdump/src/uifunctions.ycp Mon Aug 6 10:49:29 2007 @@ -54,12 +54,14 @@ "password" : "", ]; +/** + * definition UI terms for saveing dump target + * + * terms + */ term local_filesystem = `VBox( `Frame(_("Local Filesystem"),`HBox(`HSpacing(1),`VBox( - //`Left(`ComboBox(`id("local_partitions"), "&The List of Available Paritions of All Disks with Filesystem")), - //`Left(`CheckBox(`id("enable_raw_partit"),"&Enable Save Image to Raw Partition")), - //`Left(`ComboBox(`id("raw_partitions"), "&The List of Raw Paritions of All isks Without Filesystem")), `Left(`HBox( `TextEntry(`id("dir"), _("&Directory for Saving Dumps")), `VBox ( `Label(""), @@ -153,9 +155,9 @@ void StoreEnableDisalbeKdump (string key, map event) { string radiobut = (string) UI::QueryWidget(`id("EnableDisalbeKdump"), `Value); if (radiobut == "enable_kdump") { - Kdump::crashkernel_param = true; + Kdump::add_crashkernel_param = true; } else { - Kdump::crashkernel_param = false; + Kdump::add_crashkernel_param = false; } } @@ -296,8 +298,8 @@ /** - * Function initializes option "Kdump Command Line" - * or "Kdump Command Line Append" + * Function initializes option "Save Traget for Kdump Images" + * */ void InitTargetKdump (string key) { @@ -349,7 +351,7 @@ } /** - * Function handles "Saving Target for kdump Image" + * Function handles "Saving Target for Kdump Image" * */ @@ -416,7 +418,7 @@ /** * Function validates options in - * "Saving Target for kdump Image" + * "Saving Target for Kdump Image" */ boolean ValidTargetKdump (string key, map event) { @@ -636,6 +638,13 @@ KDUMP_SAVE_TARGET["password"] = ""; } Kdump::KDUMP_SETTINGS["KDUMP_SAVEDIR"] = tostringKDUMP_SAVE_TARGET(); + + if (radiobut != "local_filesystem") { + if ((Kdump::KDUMP_SETTINGS["KDUMP_RUNLEVEL"]:nil != "3") || + (Kdump::KDUMP_SETTINGS["KDUMP_RUNLEVEL"]:nil != "5")) + Kdump::KDUMP_SETTINGS["KDUMP_RUNLEVEL"] = "3"; + } + } @@ -646,16 +655,16 @@ void InitRawPartitions (string key) { if (Kdump::KDUMP_SETTINGS["KDUMP_DUMPDEV"]:nil != "") { - UI::ChangeWidget(`id("raw_partitions"), `Items, Kdump::available_partitions); - string value = tostring(find(string key, Kdump::available_partitions, + UI::ChangeWidget(`id("raw_partitions"), `Items, Kdump::uknown_fs_partitions); + string value = tostring(find(string key, Kdump::uknown_fs_partitions, ``(find(key, Kdump::KDUMP_SETTINGS["KDUMP_DUMPDEV"]:nil) != -1))); //Popup::Message(value); if ((value != nil) && (value != "")) UI::ChangeWidget(`id("raw_partitions"), `Value, value); else Popup::Error("Partition doesn't exist on your disks!"); - } else if (size(Kdump::available_partitions)>0) { - UI::ChangeWidget(`id("raw_partitions"), `Items, Kdump::available_partitions); //uknown_fs_partitions); + } else if (size(Kdump::uknown_fs_partitions)>0) { + UI::ChangeWidget(`id("raw_partitions"), `Items, Kdump::uknown_fs_partitions); //uknown_fs_partitions); //UI::ChangeWidget(`id("enable_raw_partitions"), `Value, false); } else { UI::ChangeWidget(`id("enable_raw_partitions"), `Value, false); @@ -959,7 +968,7 @@ void InitKdumpMemory (string key) { if (Kdump::total_memory > 0) { UI::ChangeWidget(`id("total_memory"), `Value, tostring(Kdump::total_memory)); - UI::ChangeWidget(`id("memory_buffer"), `Value, 128); + UI::ChangeWidget(`id("memory_buffer"), `Value, tointeger(Kdump::alocated_memory)); UI::ChangeWidget(`id("usable_memory"), `Value, tostring((Kdump::total_memory - (integer) UI::QueryWidget(`id("memory_buffer"), `Value)))); } else { @@ -992,6 +1001,17 @@ /** + * Store function for option + * "Dump Level" + */ + +void StoreKdumpMemory (string key, map event) { + Kdump::alocated_memory = tostring(UI::QueryWidget(`id("memory_buffer"), `Value)); + +} + + +/** * Function initializes option * "Custom kdump Kernel" */ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org