[yast-commit] r67489 - in /trunk/s390/src: clients/dasd.ycp clients/dasd_auto.ycp clients/zfcp.ycp dasd/dialogs.ycp dasd/wizards.ycp modules/ZFCPController.ycp zfcp/dialogs.ycp zfcp/helps.ycp zfcp/wizards.ycp
Author: aschnell Date: Mon Feb 20 18:15:21 2012 New Revision: 67489 URL: http://svn.opensuse.org/viewcvs/yast?rev=67489&view=rev Log: - work on getting zfcp modules working with autoyast editor Modified: trunk/s390/src/clients/dasd.ycp trunk/s390/src/clients/dasd_auto.ycp trunk/s390/src/clients/zfcp.ycp trunk/s390/src/dasd/dialogs.ycp trunk/s390/src/dasd/wizards.ycp trunk/s390/src/modules/ZFCPController.ycp trunk/s390/src/zfcp/dialogs.ycp trunk/s390/src/zfcp/helps.ycp trunk/s390/src/zfcp/wizards.ycp Modified: trunk/s390/src/clients/dasd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/dasd.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/clients/dasd.ycp (original) +++ trunk/s390/src/clients/dasd.ycp Mon Feb 20 18:15:21 2012 @@ -8,16 +8,9 @@ * * Main file for controller configuration. Uses all other files. */ - { - -/*** - * <h3>Configuration of controller</h3> - */ - textdomain "s390"; -/* The main () */ y2milestone ("----------------------------------------"); y2milestone ("DASD module started"); @@ -29,7 +22,7 @@ include "s390/dasd/wizards.ycp"; map cmdline_description = $[ - "id" : "controller", + "id" : "DASD", // Command line help text for the Xcontroller module "help" : _("Configuration of DASD"), "guihandler" : DASDSequence, @@ -46,19 +39,11 @@ ] ]; - -/* main ui function */ -any ret = nil; - -ret = CommandLine::Run(cmdline_description); -//ret = DASDSequence (); +any ret = CommandLine::Run(cmdline_description); y2debug("ret=%1", ret); -/* Finish */ y2milestone("DASD module finished"); y2milestone("----------------------------------------"); return ret; - -/* EOF */ } Modified: trunk/s390/src/clients/dasd_auto.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/dasd_auto.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/clients/dasd_auto.ycp (original) +++ trunk/s390/src/clients/dasd_auto.ycp Mon Feb 20 18:15:21 2012 @@ -121,5 +121,4 @@ y2milestone("----------------------------------------"); return ret; - } Modified: trunk/s390/src/clients/zfcp.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/zfcp.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/clients/zfcp.ycp (original) +++ trunk/s390/src/clients/zfcp.ycp Mon Feb 20 18:15:21 2012 @@ -8,16 +8,9 @@ * * Main file for controller configuration. Uses all other files. */ - { - -/*** - * <h3>Configuration of controller</h3> - */ - textdomain "s390"; -/* The main () */ y2milestone ("----------------------------------------"); y2milestone ("ZFCP module started"); @@ -31,8 +24,8 @@ map cmdline_description = $[ "id" : "ZFCP", // Command line help text for the Xcontroller module - "help" : _("ZFCP configuration"), - "guihandler" : ZFCPSequence, //ControllerSequence, + "help" : _("Configuration of ZFCP"), + "guihandler" : ZFCPSequence, "initialize" : ZFCPController::Read, "finish" : ZFCPController::Write, "actions" : $[ @@ -46,20 +39,11 @@ ] ]; - -/* main ui function */ -any ret = nil; - -//ret = CommandLine::Run(cmdline_description); -//ret = ZFCPSequence (); -ret = CommandLine::Run(cmdline_description); +any ret = CommandLine::Run(cmdline_description); y2debug("ret=%1", ret); -/* Finish */ y2milestone("ZFCP module finished"); y2milestone("----------------------------------------"); return ret; - -/* EOF */ } Modified: trunk/s390/src/dasd/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/dasd/dialogs.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/dasd/dialogs.ycp (original) +++ trunk/s390/src/dasd/dialogs.ycp Mon Feb 20 18:15:21 2012 @@ -38,9 +38,9 @@ * Read settings dialog * @return `abort if aborted and `next otherwise */ -symbol ReadDialog() { +symbol ReadDialog() +{ Wizard::RestoreHelp(DASD_HELPS["read"]:""); - // Controller::AbortFunction = PollAbort; boolean ret = DASDController::Read(); return ret ? `next : `abort; } @@ -49,9 +49,9 @@ * Write settings dialog * @return `abort if aborted and `next otherwise */ -symbol WriteDialog() { +symbol WriteDialog() +{ Wizard::RestoreHelp(DASD_HELPS["write"]:""); - // Controller::AbortFunction = PollAbort; boolean ret = DASDController::Write(); return ret ? `next : `abort; } @@ -273,7 +273,7 @@ } foreach (integer id, selected, { - string channel = DASDController::devices[id,"channel"]:""; + string channel = DASDController::devices[id, "channel"]:""; boolean diag = DASDController::diag[channel]:false; DASDController::ActivateDisk(channel, diag); }); @@ -295,7 +295,7 @@ } foreach (integer id, selected, { - string channel = DASDController::devices[id,"channel"]:""; + string channel = DASDController::devices[id, "channel"]:""; boolean diag = DASDController::diag[channel]:false; DASDController::DeactivateDisk(channel, diag); }); @@ -461,12 +461,6 @@ */ symbol AddDASDDiskDialog() { - if (!Mode::config()) - { - y2error("DASD Add Disk dialog shouldn't be run in Mode::config()"); - return `back; - } - /* Minimal text for the help */ string help = DASD_HELPS["disk_add_config"]:""; @@ -559,12 +553,6 @@ */ symbol DeleteDASDDiskDialog() { - if (!Mode::config()) - { - y2error("DASD Delete Disk dialog shouldn't be run in Mode::config()"); - return `back; - } - list<integer> selected = ListSelectedDASD(); if (isempty(selected)) { Modified: trunk/s390/src/dasd/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/dasd/wizards.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/dasd/wizards.ycp (original) +++ trunk/s390/src/dasd/wizards.ycp Mon Feb 20 18:15:21 2012 @@ -42,7 +42,7 @@ "delete" : $[ `abort : `abort, `next : "main" - ], + ] ]; return Sequencer::Run(aliases, sequence); Modified: trunk/s390/src/modules/ZFCPController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/ZFCPController.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/modules/ZFCPController.ycp (original) +++ trunk/s390/src/modules/ZFCPController.ycp Mon Feb 20 18:15:21 2012 @@ -14,12 +14,10 @@ textdomain "s390"; import "Mode"; -import "Progress"; import "Report"; -import "Stage"; -import "Summary"; import "Popup"; + global map<integer,map<string,any> > devices = $[]; global string filter_min = "0.0.0000"; @@ -36,6 +34,7 @@ global void ProbeDisks(); global boolean GetModified(); + boolean disk_configured = false; /** @@ -136,39 +135,77 @@ } + global string GetNextLUN(string fcp_lun) + { + if (fcp_lun == nil || fcp_lun == "") + fcp_lun = "0"; + + integer old_lun = tointeger(fcp_lun); + integer new_lun = old_lun; + + foreach (integer k, map<string, any> v, devices, { + if (old_lun == tointeger(v["detail", "fcp_lun"]:"")) + { + if (v["vendor"]:"" == "IBM" && v["device"]:"" == "25f03") + new_lun = old_lun + 0x100000000; + else + new_lun = old_lun + 1; + } + }); + + return tohexstring(new_lun, 16); + } + + /** * Read all controller settings * @return true on success */ global boolean Read() { + ProbeDisks(); + disk_configured = false; return true; } + /** * Write all controller settings * @return true on success */ global boolean Write() { - if (disk_configured && Mode::normal ()) + if (!Mode::normal()) + { + foreach (integer index, map<string, any> device, devices, { + string channel = device["controller_id"]:""; + string wwpn = device["wwpn"]:""; + string lun = device["fcp_lun"]:""; + ActivateDisk(channel, wwpn, lun); + }); + } + + if (!Mode::installation()) { - // popup label - UI::OpenDialog(`Label(_("Running mkinitrd and zipl."))); + if (disk_configured) + { + // popup label + UI::OpenDialog(`Label(_("Running mkinitrd and zipl."))); - string command = "/sbin/mkinitrd && /sbin/zipl"; - y2milestone ("Running command %1", command); - any ret = SCR::Execute(.target.bash, command); - y2milestone("Exit code: %1", ret); + string command = "/sbin/mkinitrd && /sbin/zipl"; + y2milestone ("Running command %1", command); + any ret = SCR::Execute(.target.bash, command); + y2milestone("Exit code: %1", ret); - UI::CloseDialog(); + UI::CloseDialog(); + } } return true; - } + /** * Get all controller settings from the first parameter * (For use by autoinstallation.) @@ -177,12 +214,10 @@ */ global boolean Import(map settings) { - if (Mode::config ()) - { integer index = -1; devices = listmap (map d, settings["devices"]:[], { index = index + 1; - map<string,any> m = $[ + map<string, any> m = $[ "detail" : $[ "controller_id" : d["controller_id"]:"", "wwpn" : d["wwpn"]:"", @@ -191,16 +226,11 @@ ]; return $[ index : m ]; }); - } - else if (Stage::initial ()) - { - foreach (map d, settings["devices"]:[], { - ActivateDisk (d["controller_id"]:"", d["wwpn"]:"", d["fcp_lun"]:""); - }); - } + return true; } + /** * Dump the controller settings to a single map * (For use by autoinstallation.) @@ -208,19 +238,14 @@ */ global map Export() { -ProbeDisks(); - list<map<string,any> > l = maplist (integer k, map<string,any> v, - devices, - { + list<map<string, any> > l = maplist (integer k, map<string, any> v, devices, { return $[ - "controller_id" : v["detail","controller_id"]:"", - "wwpn" : v["detail","wwpn"]:"", - "fcp_lun" : v["detail","fcp_lun"]:"", - ]; - }); - return $[ - "devices" : l, - ]; + "controller_id" : v["detail", "controller_id"]:"", + "wwpn" : v["detail", "wwpn"]:"", + "fcp_lun" : v["detail", "fcp_lun"]:"", + ]; }); + + return $[ "devices" : l, ]; } @@ -359,9 +384,6 @@ */ global void ProbeDisks() { -/* if (Mode::config ()) - return;*/ - // popup label UI::OpenDialog(`Label(_("Reading Configured ZFCP Devices"))); @@ -379,6 +401,8 @@ return $[ index : d ]; }); + y2milestone("probed zfcps %1", devices); + UI::CloseDialog(); } Modified: trunk/s390/src/zfcp/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/zfcp/dialogs.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/zfcp/dialogs.ycp (original) +++ trunk/s390/src/zfcp/dialogs.ycp Mon Feb 20 18:15:21 2012 @@ -20,13 +20,26 @@ include "s390/zfcp/helps.ycp"; + + /** + * List ZFCP devices that are currently being selected + * @return list<integer> list of IDs of selected ZFCP devices + */ + list<integer> ListSelectedZFCP() + { + list<integer> selected = (list<integer>) UI::QueryWidget(`id(`table), `SelectedItems); + y2milestone("selected %1", selected); + return selected; + } + + /** * Read settings dialog * @return `abort if aborted and `next otherwise */ -symbol ReadDialog() { +symbol ReadDialog() +{ Wizard::RestoreHelp(ZFCP_HELPS["read"]:""); - // Controller::AbortFunction = PollAbort; boolean ret = ZFCPController::Read(); return ret ? `next : `abort; } @@ -35,9 +48,9 @@ * Write settings dialog * @return `abort if aborted and `next otherwise */ -symbol WriteDialog() { +symbol WriteDialog() +{ Wizard::RestoreHelp(ZFCP_HELPS["write"]:""); - // Controller::AbortFunction = PollAbort; boolean ret = ZFCPController::Write(); return ret ? `next : `abort; } @@ -71,20 +84,6 @@ /** - * Restart the ZFCP-Dialog - */ -void ReloadZFCPDialog() -{ - ZFCPController::ProbeDisks(); - - list<term> items = GetZFCPDiskItems(); - - UI::ChangeWidget(`id(`table), `Items, items); - UI::ChangeWidget(`id(`delete), `Enabled, !isempty(items)); - UI::SetFocus(`table); -} - -/** * Show the ZFCP-Dialog */ void DisplayZFCPDialog() @@ -118,7 +117,7 @@ ) ), `HBox( - `Table(`id(`table), `opt(`notify), header, []) + `Table(`id(`table), `opt(`multiSelection), header, []) ), `HBox( `PushButton(`id(`add), Label::AddButton ()), @@ -127,8 +126,6 @@ ) ); - y2debug("Content: %1\n", content); - /* Apply the settings */ Wizard::SetContentsButtons(caption, content, help, Label::BackButton(), Label::NextButton()); Wizard::HideBackButton(); Wizard::SetAbortButton(`abort, Label::CancelButton() ); @@ -139,6 +136,20 @@ /** + * Restart the ZFCP-Dialog + */ +void ReloadZFCPDialog() +{ + list<term> items = GetZFCPDiskItems(); + + list<integer> selected = (list<integer>) UI::QueryWidget(`id(`table), `SelectedItems); + UI::ChangeWidget(`id(`table), `Items, items); + UI::ChangeWidget(`id(`table), `SelectedItems, selected); + UI::SetFocus(`table); +} + + +/** * Show the ZFCP-Dialog * @return symbol From the dialog */ @@ -147,15 +158,10 @@ DisplayZFCPDialog (); ReloadZFCPDialog (); - any ret = nil; - - integer selected = 0; - + symbol ret = nil; while (ret == nil) { - ret = UI::UserInput(); - - selected = (integer) UI::QueryWidget (`id (`table), `CurrentItem); + ret = (symbol) UI::UserInput(); if (ret == `filter) { @@ -177,6 +183,11 @@ ret = nil; continue; } + else if (ret == `table) + { + ret = nil; + continue; + } else if (ret == `abort || ret == `cancel) { // yes-no popup @@ -185,46 +196,14 @@ { ret = nil; } + continue; } - else if (ret == `delete) - { - map<string,any> descr = ZFCPController::devices[selected]:$[]; - string dev_name = (string)(descr["dev_name"]:""); - string channel = descr["detail", "controller_id"]:"unknown"; - string wwpn = descr["detail", "wwpn"]:"unknown"; - string fcp_lun = descr["detail", "fcp_lun"]:"unknown"; - - // popup qestion, %1 is device name (eg. /dev/sda) - if (! Popup::YesNo (sformat (_("Remove device %1?"), dev_name))) - { - ret = nil; - continue; - } - if (Mode::config ()) - { - ZFCPController::devices - = remove (ZFCPController::devices, selected); - } - else - { - ZFCPController::DeactivateDisk (channel, wwpn, fcp_lun); - } - ReloadZFCPDialog (); - ret = nil; - } - } - if (ret == `add) - { - map<string,any> descr = ZFCPController::devices[selected]:$[]; - string dev_name = (string)(descr["dev_name"]:""); - string channel = descr["controller_id"]:"unknown"; - string wwpn = descr["detail", "wwpn"]:"unknown"; - if (wwpn != "unknown") - ZFCPController::previous_settings["wwpn"] = wwpn; } - return (symbol) ret; + + return ret; } + /** * Add ZFCP-Dialog * @return symbol the dialog @@ -238,25 +217,9 @@ string caption = _("Add New ZFCP Device"); string fcp_lun = ZFCPController::previous_settings["fcp_lun"]:""; - if (fcp_lun == nil || fcp_lun == "") - fcp_lun = "0"; - integer i_lun = tointeger (fcp_lun); - integer new_lun = i_lun; - - foreach (integer k, map<string,any> v, ZFCPController::devices, { - if (i_lun == tointeger (v["detail", "fcp_lun"]:"")) - { - if (v["vendor"]:"" == "IBM" && v["device"]:"" == "25f03") - new_lun = i_lun + tointeger ("0x100000000"); - else - new_lun = i_lun + 1; - } - }); - fcp_lun = tohexstring (new_lun); - if (fcp_lun != "") - fcp_lun = ZFCPController::HexNumSize (fcp_lun, 16); + fcp_lun = ZFCPController::GetNextLUN(fcp_lun); - list<string>items = []; + list<string> items = []; if (Mode::config ()) { items = maplist (integer index, map<string, any> d, ZFCPController::devices, { @@ -368,9 +331,10 @@ string channel = (string) UI::QueryWidget(`id(`channel), `Value); string wwpn = (string) UI::QueryWidget(`id(`wwpn), `Value); string lun = (string) UI::QueryWidget(`id(`fcp_lun), `Value); - ZFCPController::previous_settings["wwpm"] = wwpn; - ZFCPController::previous_settings["fcp_lun"] = lun; + ZFCPController::previous_settings["channel"] = channel; + ZFCPController::previous_settings["wwpn"] = wwpn; + ZFCPController::previous_settings["fcp_lun"] = lun; if (Mode::config()) { @@ -393,4 +357,40 @@ return ret; } + +/** + * Run the dialog for deleting ZFCPs + * @return symbol from DeleteZFCPDiskDialog + */ +symbol DeleteZFCPDiskDialog() +{ + list<integer> selected = ListSelectedZFCP(); + if (isempty(selected)) + { + // error popup message + Popup::Message (_("No disk selected.")); + } + else + { + if (Mode::config()) + { + foreach(integer index, selected, { ZFCPController::RemoveDevice(index); }); + } + else + { + foreach(integer index, selected, { + map d = ZFCPController::devices[index]:$[]; + string channel = d["detail", "controller_id"]:"unknown"; + string wwpn = d["detail", "wwpn"]:"unknown"; + string fcp_lun = d["detail", "fcp_lun"]:"unknown"; + ZFCPController::DeactivateDisk(channel, wwpn, fcp_lun); + }); + + ZFCPController::ProbeDisks(); + } + } + + return `next; +} + } Modified: trunk/s390/src/zfcp/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/zfcp/helps.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/zfcp/helps.ycp (original) +++ trunk/s390/src/zfcp/helps.ycp Mon Feb 20 18:15:21 2012 @@ -6,9 +6,7 @@ * * $Id$ */ - { - textdomain "s390"; /** @@ -74,5 +72,4 @@ ]; -/* EOF */ } Modified: trunk/s390/src/zfcp/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/zfcp/wizards.ycp?rev=67489&r1=67488&r2=67489&view=diff ============================================================================== --- trunk/s390/src/zfcp/wizards.ycp (original) +++ trunk/s390/src/zfcp/wizards.ycp Mon Feb 20 18:15:21 2012 @@ -23,7 +23,8 @@ { map aliases = $[ "main" : ``(ZFCPDialog()), - "add" : ``(AddZFCPDiskDialog()) + "add" : ``(AddZFCPDiskDialog()), + "delete" : ``(DeleteZFCPDiskDialog()) ]; map sequence = $[ @@ -31,12 +32,17 @@ "main" : $[ `abort : `abort, `next : `next, - `add : "add", + `add : "add", + `delete : "delete" ], "add" : $[ `abort : `abort, - `next : "main", + `next : "main" ], + "delete" : $[ + `abort : `abort, + `next : "main" + ] ]; return Sequencer::Run(aliases, sequence); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn2.opensuse.org