Author: juhliarik
Date: Mon Jun 4 17:07:43 2007
New Revision: 38272
URL: http://svn.opensuse.org/viewcvs/yast?rev=38272&view=rev
Log:
added functions for handling setting for memory
Modified:
trunk/kdump/src/Kdump.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=38272&r1=38271&r2=38272&view=diff
==============================================================================
--- trunk/kdump/src/Kdump.ycp (original)
+++ trunk/kdump/src/Kdump.ycp Mon Jun 4 17:07:43 2007
@@ -76,6 +76,14 @@
global list <string> uknown_fs_partitions =[];
/**
+ * Total available memory
+ *
+ *
+ * integer
+ */
+global integer total_memory =0;
+
+/**
* Boolean option indicates kernel parameter
* "crashkernel"
*
@@ -232,7 +240,36 @@
return true;
}
+/**
+ * Read available memory
+ *
+ * read kernel parameter "crashkernel"
+ * @return boolean successfull
+ */
+boolean ReadAvailableMemory () {
+ list <map> output = (list<map>)SCR::Read(.probe.memory);
+ y2milestone("[kdump] (ReadAvailableMemory) SCR::Read(.probe.memory): %1", output);
+
+ map resor = $[];
+ list <any> temp = maplist(map mem, output,{
+ return mem["resource"]:nil;
+ });
+ //y2milestone("[kdump] (ReadAvailableMemory) temp: %1", temp);
+ resor = tomap(temp[0]:nil);
+
+ output = (list<map>)resor["phys_mem"]:nil;
+ temp = maplist(map mem, output,{
+ return mem["range"]:nil;
+ });
+ //list <any> range = maplist(map resor["phys_mem"]:nil);
+
+ //resor = (map)range;
+ total_memory = tointeger(temp[0]:nil)/1048576;
+ y2milestone("[kdump] (ReadAvailableMemory) total phys. memory [MB]: %1", tostring(total_memory));
+
+ return true;
+}
/**
* Read current kdump configuration
*
@@ -262,22 +299,27 @@
/* Kdump read dialog caption */
string caption = _("Initializing kdump Configuration");
- integer steps = 3;
+ integer steps = 4;
sleep(sl);
Progress::New( caption, " ", steps, [
- /* Progress stage 1/3 */
+ /* Progress stage 1/4 */
_("Read the config file"),
- /* Progress stage 2/3 */
+ /* Progress stage 2/4 */
_("Read disk partitions"),
- /* Progress stage 3/3 */
+ /* Progress stage 3/4 */
_("Read kernel boot options"),
+ /* Progress stage 4/4 */
+ _("Read available memory"),
+
], [
- /* Progress step 1/3 */
+ /* Progress step 1/4 */
_("Reading the config file..."),
- /* Progress step 2/3*/
+ /* Progress step 2/4*/
_("Reading partitions of disks..."),
- /* Progress finished 3/3*/
+ /* Progress finished 3/4*/
+ _("Reading available memory..."),
+ /* Progress finished 4/4*/
Message::Finished()
],
""
@@ -305,6 +347,12 @@
if(!ReadKdumpKernelParam ()) Report::Error(_("Cannot read kernel boot options"));
//sleep(sl);
+ // read another database
+ if(Abort()) return false;
+ Progress::NextStep();
+ /* Error message */
+ if(!ReadAvailableMemory ()) Report::Error(_("Cannot read available memory"));
+ //sleep(sl);
if(Abort()) return false;
/* Progress finished */
Modified: trunk/kdump/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/dialogs.ycp?rev=38272&r1=38271&r2=38272&view=diff
==============================================================================
--- trunk/kdump/src/dialogs.ycp (original)
+++ trunk/kdump/src/dialogs.ycp Mon Jun 4 17:07:43 2007
@@ -225,18 +225,18 @@
"custom_widget" : `HSquash(`VBox(
`Left(`HBox(
`Left(`Label("Total System Memory [MB]:")),
- `Left(`Label(`id("total_memory"),"4096")),
+ `Left(`Label(`id("total_memory"),"0123456789")),
`HStretch ()
)),
`Left(`HBox(
`Left(`Label("Usable Memory [MB]:")),
- `Left(`Label(`id("usable_memory"),"3968")),
+ `Left(`Label(`id("usable_memory"),"0123456789")),
`HStretch ()
)),
- `Left(`IntField(`id("memory_buffer"), _("Kdump Memor&y [MB]"),128,4096,128))
+ `Left(`IntField(`id("memory_buffer"), `opt(`notify), _("Kdump Memor&y [MB]"),128,4096,128))
)),
- //"init" :
- //"handle" :
+ "init" : InitKdumpMemory,
+ "handle" : HandleKdumpMemory,
//"store" :
"help" : HelpKdump("KdumpMemory"),
],
Modified: trunk/kdump/src/uifunctions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/uifunctions.ycp?rev=38272&r1=38271&r2=38272&view=diff
==============================================================================
--- trunk/kdump/src/uifunctions.ycp (original)
+++ trunk/kdump/src/uifunctions.ycp Mon Jun 4 17:07:43 2007
@@ -165,7 +165,8 @@
*/
symbol HandleTargetKdump (string key, map event) {
- any radiobutton = UI::QueryWidget(`id("DumpTarget"), `CurrentButton);
+
+ any radiobutton = event["ID"]:nil;
if (radiobutton == "local_filesystem") {
UI::ReplaceWidget (`id ("Network"), `Empty());
@@ -177,17 +178,17 @@
if (!set_network)
UI::ReplaceWidget (`id ("Network"), network);
set_network = true;
- any net = UI::QueryWidget(`id("NetworkRB"), `CurrentButton);
- if (net == "ftp") {
- UI::ReplaceWidget (`id ("Targets"), ftp);
- } else if (net == "ssh") {
- UI::ReplaceWidget (`id ("Targets"), ssh);
- } else if (net == "nfs") {
- UI::ReplaceWidget (`id ("Targets"), nfs);
- } else if (net == "smb") {
- UI::ReplaceWidget (`id ("Targets"), smb);
- }
+ //any net = UI::QueryWidget(`id("NetworkRB"), `CurrentButton);
+ } else if (radiobutton == "ftp") {
+ UI::ReplaceWidget (`id ("Targets"), ftp);
+ } else if (radiobutton == "ssh") {
+ UI::ReplaceWidget (`id ("Targets"), ssh);
+ } else if (radiobutton == "nfs") {
+ UI::ReplaceWidget (`id ("Targets"), nfs);
+ } else if (radiobutton == "smb") {
+ UI::ReplaceWidget (`id ("Targets"), smb);
}
+
return nil;
}
@@ -468,17 +469,44 @@
}
+/**
+ * Function initializes option
+ * "KdumpMemory"
+ */
+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("usable_memory"), `Value,
+ tostring((Kdump::total_memory - (integer) UI::QueryWidget(`id("memory_buffer"), `Value))));
+ } else {
+ UI::ChangeWidget(`id("total_memory"), `Value, "0");
+ UI::ChangeWidget(`id("usable_memory"), `Value, "0");
+ UI::ChangeWidget(`id("memory_buffer"), `Enabled, false);
+ }
+}
+/**
+ * Hadle function for option
+ * "Dump Level"
+ */
+symbol HandleKdumpMemory (string key, map event) {
+ any ret = event["ID"]:nil;
+ if (ret == "memory_buffer") {
+ integer value = (integer) UI::QueryWidget(`id("memory_buffer"), `Value);
+ if (value > Kdump::total_memory) {
+ UI::ChangeWidget(`id("memory_buffer"), `Value, Kdump::total_memory);
+ UI::ChangeWidget(`id("usable_memory"), `Value, "0");
+ } else {
+ UI::ChangeWidget(`id("usable_memory"), `Value,
+ tostring((Kdump::total_memory - (integer) UI::QueryWidget(`id("memory_buffer"), `Value))));
+ }
+ }
-
-
-
-
-
-
+}
}
\ No newline at end of file
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org