Author: aschnell
Date: Wed Feb 15 11:46:23 2012
New Revision: 67431
URL: http://svn.opensuse.org/viewcvs/yast?rev=67431&view=rev
Log:
- make DASD module work for autoyast editor
Modified:
trunk/s390/package/yast2-s390.changes
trunk/s390/src/dasd/dialogs.ycp
trunk/s390/src/modules/DASDController.ycp
Modified: trunk/s390/package/yast2-s390.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/package/yast2-s390.changes?rev=67431&r1=67430&r2=67431&view=diff
==============================================================================
--- trunk/s390/package/yast2-s390.changes (original)
+++ trunk/s390/package/yast2-s390.changes Wed Feb 15 11:46:23 2012
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Wed Feb 15 11:25:49 CET 2012 - aschnell@suse.de
+
+- make DASD module work for autoyast editor
+
+-------------------------------------------------------------------
Fri Feb 10 14:59:45 CET 2012 - aschnell@suse.de
- used multiselection table in main DASD dialog
Modified: trunk/s390/src/dasd/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/dasd/dialogs.ycp?rev=67431&r1=67430&r2=67431&view=diff
==============================================================================
--- trunk/s390/src/dasd/dialogs.ycp (original)
+++ trunk/s390/src/dasd/dialogs.ycp Wed Feb 15 11:46:23 2012
@@ -72,7 +72,7 @@
if (Mode::config ())
{
items = maplist (integer k, map d, devices, {
- string channel = d["channel_id"]:"";
+ string channel = d["channel"]:"";
string diag = String::YesNo(d["diag"]:false);
string format = String::YesNo(d["format"]:false);
return `item(`id(k), channel, format, diag);
@@ -217,8 +217,6 @@
DASDController::filter_min = (string) UI::QueryWidget(`min_chan, `Value);
DASDController::filter_max = (string) UI::QueryWidget(`max_chan, `Value);
- DASDController::ProbeDisks();
-
list<term> items = GetDASDDiskItems();
list<integer> selected = (list<integer>) UI::QueryWidget(`id(`table), `SelectedItems);
@@ -242,7 +240,8 @@
{
ret = UI::UserInput();
- if (ret == `filter) {
+ if (ret == `filter)
+ {
ReloadDASDDialog ();
ret = nil;
continue;
@@ -269,6 +268,8 @@
DASDController::ActivateDisk(channel, diag);
});
+ DASDController::ProbeDisks();
+
ReloadDASDDialog ();
ret = nil;
}
@@ -289,6 +290,8 @@
DASDController::DeactivateDisk(channel, diag);
});
+ DASDController::ProbeDisks();
+
ReloadDASDDialog ();
ret = nil;
}
@@ -311,6 +314,8 @@
DASDController::ActivateDisk(channel, true);
});
+ DASDController::ProbeDisks();
+
ReloadDASDDialog ();
ret = nil;
}
@@ -333,6 +338,8 @@
DASDController::ActivateDisk(channel, false);
});
+ DASDController::ProbeDisks();
+
ReloadDASDDialog ();
ret = nil;
}
@@ -428,6 +435,7 @@
return DASDController::devices[id, "dev_name"]:"";
});
DASDController::FormatDisks (devices, par, write_vl, true);
+ DASDController::ProbeDisks();
ReloadDASDDialog ();
UI::SetFocus (`table);
ret = nil;
@@ -436,6 +444,7 @@
return (symbol)ret;
}
+
/**
* Run the dialog for adding DASDs
* @return symbol from AddDASDDiskDialog
@@ -489,19 +498,24 @@
{
ret = nil;
}
+ }
+ else if (ret == `next)
+ {
+ // TODO check for duplicate channel
}
}
if (ret == `next)
{
- string channel = (string)UI::QueryWidget (`id (`channel), `Value);
- boolean format = (boolean)UI::QueryWidget (`id (`format), `Value);
- boolean diag = (boolean)UI::QueryWidget (`id (`diag), `Value);
+ string channel = (string) UI::QueryWidget(`id(`channel), `Value);
+ boolean format = (boolean) UI::QueryWidget(`id(`format), `Value);
+ boolean diag = (boolean) UI::QueryWidget(`id(`diag), `Value);
map m = $[
- "channel_id" : channel,
+ "channel" : channel,
"format" : format,
"diag" : diag,
];
+
integer index = 0;
while (haskey (DASDController::devices, index))
index = index + 1;
Modified: trunk/s390/src/modules/DASDController.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/DASDController.ycp?rev=67431&r1=67430&r2=67431&view=diff
==============================================================================
--- trunk/s390/src/modules/DASDController.ycp (original)
+++ trunk/s390/src/modules/DASDController.ycp Wed Feb 15 11:46:23 2012
@@ -14,15 +14,13 @@
textdomain "s390";
import "Mode";
-import "Progress";
import "Report";
-import "Stage";
-import "Summary";
import "Arch";
import "FileUtils";
import "Popup";
import "String";
+
global map > devices = $[];
global string filter_min = "0.0.0000";
@@ -49,7 +47,7 @@
/**
* Data was modified?
*/
-global boolean modified = false;
+global boolean modified = true; // TODO
/**
*/
@@ -95,21 +93,64 @@
return true;
}
+
+ string GetDeviceName(string channel)
+ {
+ string cmd = sformat("ls '/sys/bus/ccw/devices/%1/block/' | tr -d '\n'", channel);
+ map disk = (map) SCR::Execute(.target.bash_output, cmd);
+ if (disk["exit"]:-1 == 0 && !isempty(disk["stdout"]:""))
+ return sformat("/dev/%1", disk["stdout"]:"");
+
+ return nil;
+ }
+
+
/**
* Read all controller settings
* @return true on success
*/
-global boolean Read() {
+global boolean Read()
+{
+ ProbeDisks();
+
+ devices = mapmap(integer index, map d, devices, {
+ d["format"] = d["format"]:false;
+ d["diag"] = d["diag"]:false;
+ return $[ index : d ];
+ });
+
disk_configured = false;
return true;
-
}
+
/**
* Write all controller settings
* @return true on success
*/
-global boolean Write() {
+global boolean Write()
+{
+ list<string> to_format = [];
+
+ foreach(integer index, map device, devices, {
+ string channel = device["channel"]:"";
+ boolean format = device["format"]:false;
+ boolean do_diag = device["diag"]:false;
+ ActivateDisk(channel, do_diag);
+
+ if (format)
+ {
+ string dev_name = GetDeviceName(channel);
+ if (dev_name != nil)
+ to_format = add(to_format, dev_name);
+ }
+ });
+
+ y2milestone ("Disks to format: %1", to_format);
+
+ if (!isempty(to_format))
+ FormatDisks(to_format, 8, true, true);
+
if (disk_configured && Mode::normal ())
{
string command = "/sbin/mkinitrd && /sbin/zipl";
@@ -121,6 +162,7 @@
{
y2milestone ("No new disk configured");
}
+
return true;
}
@@ -130,50 +172,19 @@
* @param settings The YCP structure to be imported.
* @return boolean True on success
*/
-global boolean Import (map settings) {
- if (Mode::config ())
- {
+global boolean Import(map settings)
+{
integer index = -1;
- devices = listmap (map d, settings["devices"]:[], {
- index = index + 1;
- return $[ index : d ];
- });
- }
- else if (Stage::initial ())
- {
- // activate all disks first
- map to_format = $[];
- foreach (map d, settings["devices"]:[], {
- boolean format = d["format"]:false;
- boolean do_diag = d["diag"]:false;
- string channel = d["channel"]:"";
- if (channel != "")
- {
- to_format[channel] = format;
- ActivateDisk (channel, do_diag);
- }
- });
+ devices = listmap (map d, settings["devices"]:[], {
+ index = index + 1;
- // now probe all disks to get the mapping between channel and device
- ProbeDisks ();
+ d = filter(string k, any v, d, {
+ return contains([ "channel", "format", "diag" ], k);
+ });
- // now map the channels of the disks to format to devices
- list<string> format_list = [];
- foreach (integer i, map d, devices, {
- string channel = d["channel"]:"";
- string device = d["dev_name"]:"";
- if (channel != "" && device != "")
- {
- if (to_format[channel]:false)
- format_list = add (format_list, device);
- }
+ return $[ index : d ];
});
- y2milestone ("Disks to format: %1", format_list);
- // now format the disks
- if (size (format_list) > 0)
- FormatDisks (format_list, 8, true, true);
- }
return true;
}
@@ -185,44 +196,16 @@
*/
global map Export()
{
- ProbeDisks();
-
- if (Mode::config())
- {
list