Author: juhliarik
Date: Fri Jun 1 10:06:33 2007
New Revision: 38233
URL: http://svn.opensuse.org/viewcvs/yast?rev=38233&view=rev
Log:
added info about disk partitions
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=38233&r1=38232&r2=38233&view=diff
==============================================================================
--- trunk/kdump/src/Kdump.ycp (original)
+++ trunk/kdump/src/Kdump.ycp Fri Jun 1 10:06:33 2007
@@ -40,6 +40,8 @@
import "Summary";
import "Message";
import "BootCommon";
+import "Storage";
+import "Map";
/**
* Prototypes
@@ -56,6 +58,23 @@
global boolean proposal_valid = false;
/**
+ * List of available partiotions
+ *
+ * list <string>
+ */
+global list <string> available_partitions =[];
+
+
+/**
+ * List of available partiotions
+ * without filesystem or with uknown
+ *
+ * list <string>
+ */
+global list <string> uknown_fs_partitions =[];
+
+
+/**
* Write only, used during autoinstallation.
* Don't run services and SuSEconfig, it's all done at one place.
*/
@@ -125,6 +144,67 @@
/**
+ * Read disk partitions
+ *
+ * @return boolean successfull
+ */
+
+boolean ReadDiskPartitions () {
+ // get complete map from Storage module
+ map tg = Storage::GetTargetMap();
+ // extract only real disks from target map.
+ map disks = filter( string k, map disk, tg, ``(disk["type"]:`CT_UNKNOWN==`CT_DISK));
+ // extract only disks
+ list <string> list_of_disks = (list<string>) Map::Keys(disks);
+ //get a list of all partitions usable for data storage
+ list <string> list_disks = (list<string>) Map::Keys(disks);
+
+ y2milestone("[kdump] (ReadDiskPartitions) ----------------Begin of ReadDiskPartitions ()--------------");
+ y2milestone("[kdump] (ReadDiskPartitions) list of disks: %1", list_disks);
+
+ list<map> data_parts = [];
+ foreach (string key, list_disks, {
+ data_parts = data_parts + filter( map p, disks[key,"partitions"]:[], ``(p["type"]:`primary!=`extended));
+ });
+ //list<map> data_parts = filter( map p, disks["/dev/sda","partitions"]:[], ``(p["type"]:`primary!=`extended));
+
+ //parse partiotions with uknown file system
+ list<map> unknown = [];
+ unknown = filter( map p, data_parts, ``(p["detected_fs"]:nil==`unknown));
+
+
+ list<string> uknown_partitions = [];
+ if (size(unknown)>0)
+ uknown_partitions = maplist( map p, unknown, ``(p["device"]:""));
+ y2milestone("[kdump] (ReadDiskPartitions) list of device names of partitions without filesystem: %1", uknown_partitions);
+ uknown_fs_partitions = uknown_partitions;
+ // get list of device names of partitions
+ list<string> parts = maplist( map p, data_parts, ``(p["device"]:""));
+
+ y2milestone("[kdump] (ReadDiskPartitions) list of device names of partitions: %1", parts);
+
+ // get list of udev ids of partitions, need to prepend "/dev/disk/by-id/"
+ list<string> udevids = maplist( map p, data_parts, ``(p["udev_id",0]:""));
+
+ y2milestone("[kdump] (ReadDiskPartitions) list of udev ids of partitions: %1", udevids);
+
+
+ //combination name + uids to one list
+ integer i = 0;
+ //available_partitions = parts;
+ foreach (string key, udevids, {
+ string value = parts[i]:"" +" - " + udevids[i]:"";
+ available_partitions = available_partitions + value;
+ i= i+1;
+ });
+
+ y2milestone("[kdump] (ReadDiskPartitions) list of available partitions (name + uid): %1", available_partitions);
+ y2milestone("[kdump] (ReadDiskPartitions) ------------End of ReadDiskPartitions ()--------------------------");
+ return true;
+}
+
+
+/**
* Read current kdump configuration
*
* @return boolean successfull
@@ -138,13 +218,9 @@
y2milestone("-------------KDUMP_SETTINGS-------------------");
y2milestone("kdump configuration has been read: %1", KDUMP_SETTINGS);
y2milestone("---------------------------------------------");
- /*
- boolean ret = BootCommon::Read(false);
- map boot = BootCommon::Export();
- y2milestone("-------------BootCommon::Read-------------------");
- y2milestone("BootCommon::bootloader_attribs : %1", boot);
- y2milestone("---------------------------------------------");
- */
+
+
+
return true;
}
@@ -164,7 +240,7 @@
/* Progress stage 1/2 */
_("Read the config file"),
/* Progress stage 2/2 */
- _("Read another settings"),
+ _("Read disk partitions"),
], [
/* Progress step 1/2 */
_("Reading the config file..."),
@@ -185,7 +261,7 @@
if(Abort()) return false;
Progress::NextStep();
/* Error message */
- if(false) Report::Error(_("Cannot read another settings."));
+ if(!ReadDiskPartitions ()) Report::Error(_("Cannot read disk partitions."));
sleep(sl);
if(Abort()) return false;
Modified: trunk/kdump/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/dialogs.ycp?rev=38233&r1=38232&r2=38233&view=diff
==============================================================================
--- trunk/kdump/src/dialogs.ycp (original)
+++ trunk/kdump/src/dialogs.ycp Fri Jun 1 10:06:33 2007
@@ -90,7 +90,19 @@
"help" : HelpKdump("RunLevel"),
],
- "EnableReboot" : $[
+ "RawDisk" : $[
+ //TRANSLATORS: ComboBox Label
+ "label" : _("&The list of available paritions without any filesystem"),
+ "widget" : `combobox,
+ "items" : [
+ ],
+ "init" : InitRawDisk,
+ //"handle" :
+ //"store" : StoreRunLevel,
+ "help" : HelpKdump("RawDisk"),
+ ],
+
+ "EnableReboot" : $[
//TRANSLATORS: CheckBox Label
"label" : _("&Enable Immediate Reboot After Saving the Core"),
"widget" : `checkbox,
@@ -146,8 +158,8 @@
"custom_widget" : `VBox(
`Frame(_("Saving Target for kdump Image"),`HBox(`HSpacing(1),`VBox(
`RadioButtonGroup(`id("DumpTarget"), `VBox(
- `Left(`RadioButton(`id("local_filesystem"), `opt(`notify), "&Local Filesytem", true)),
- `Left(`RadioButton(`id("raw_disk"), `opt(`notify), "Raw Dis&k")),
+ `Left(`RadioButton(`id("local_filesystem"), `opt(`notify), "&Local Filesytem")),
+ //`Left(`RadioButton(`id("raw_disk"), `opt(`notify), "Raw Dis&k")),
`Left(`RadioButton(`id("network"), `opt(`notify), "Net&work"))
))
@@ -158,7 +170,7 @@
`ReplacePoint(`id("Targets"), ftp),
`VStretch()
),
- //"init" :
+ "init" : InitTargetKdump,
"handle" : HandleTargetKdump,
//"store" :
"help" : HelpKdump("TargetKdump"),
@@ -332,13 +344,19 @@
`Left("RunLevel"),
`HStretch ()
))),
+
+ `VSpacing(1),
+ `Frame ( _("Saving temporary to raw partition"),`HBox(`HSpacing(1),`VBox(
+ `Left("RawDisk"),
+ `HStretch ()
+ ))),
`VStretch ()
),
"caption" : _("Kdump Expert Settings"),
"tree_item_label" : _("Expert Settings"),
"widget_names" : [
"DisBackButton","KdumpCommandLine",
- "SwitchKdumpComLine", "RunLevel",
+ "SwitchKdumpComLine", "RunLevel", "RawDisk",
]
],
Modified: trunk/kdump/src/uifunctions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/uifunctions.ycp?rev=38233&r1=38232&r2=38233&view=diff
==============================================================================
--- trunk/kdump/src/uifunctions.ycp (original)
+++ trunk/kdump/src/uifunctions.ycp Fri Jun 1 10:06:33 2007
@@ -54,7 +54,7 @@
term local_filesystem = `VBox(
`Frame(_("Local Filesystem"),`HBox(`HSpacing(1),`VBox(
- `Left(`ComboBox(`id("local_partitions"), "&Select Partition", local_partitions_list)),
+ `Left(`ComboBox(`id("local_partitions"), "&The list of available paritions of all disks with filesystem")),
`Left(`HBox(
`TextEntry(`id("dir_save_image"), _("&Directory for Saving Dumps")),
`VBox ( `Label(""),
@@ -65,19 +65,6 @@
);
-term raw_disk = `VBox(
- `Frame(_("Raw Disk"),`HBox(`HSpacing(1),`VBox(
- `Left(`ComboBox(`id("raw_partitions"), "&Select Partition", raw_partitions_list)),
- `Left(`HBox(
- `TextEntry(`id("dir_save_image"), _("&Directory for Saving Dumps")),
- `VBox ( `Label(""),
- `PushButton ( `id ("select_dir_image"), `opt ( `hstretch ), _("B&rowse"))
- )))
- )))
-
-);
-
-
term network = `VBox(
`VSpacing(1),
`Frame(_("Network"),`HBox(`HSpacing(1),
@@ -148,17 +135,33 @@
+
+
+/**
+ * Function initializes option "Kdump Command Line"
+ * or "Kdump Command Line Append"
+ */
+
+void InitTargetKdump (string key) {
+ UI::ReplaceWidget (`id ("Network"), `Empty());
+ UI::ReplaceWidget (`id ("Targets"), local_filesystem);
+ UI::ChangeWidget(`id("local_partitions"), `Items, Kdump::available_partitions);
+ y2milestone("[kdump] (InitTargetKdump) Kdump::available_partitions %1", Kdump::available_partitions);
+}
+
+/**
+ * Function handles "Saving Target for kdump Image"
+ *
+ */
+
symbol HandleTargetKdump (string key, map event) {
any radiobutton = UI::QueryWidget(`id("DumpTarget"), `CurrentButton);
if (radiobutton == "local_filesystem") {
UI::ReplaceWidget (`id ("Network"), `Empty());
UI::ReplaceWidget (`id ("Targets"), local_filesystem);
+ UI::ChangeWidget(`id("local_partitions"), `Items, Kdump::available_partitions);
set_network = false;
- } else if (radiobutton == "raw_disk") {
- UI::ReplaceWidget (`id ("Network"), `Empty());
- UI::ReplaceWidget (`id ("Targets"), raw_disk);
- set_network = false;
} else if (radiobutton == "network") {
UI::ReplaceWidget (`id ("Targets"), `Empty());
if (!set_network)
@@ -438,8 +441,22 @@
+/**
+ * Function initializes option
+ * "RawDisk"
+ */
+void InitRawDisk (string key) {
+ if (size(Kdump::uknown_fs_partitions)>0) {
+ UI::ChangeWidget(`id("RawDisk"), `Items, Kdump::uknown_fs_partitions);
+ } else {
+ UI::ChangeWidget(`id("RawDisk"), `Enabled, false);
+ }
+
+
+}
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org