Author: fehr Date: Wed Mar 28 11:54:25 2012 New Revision: 67728 URL: http://svn.opensuse.org/viewcvs/yast?rev=67728&view=rev Log: first checkin (mostly for backup purposes, code not yet complete) Added: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-lio-server.changes - copied, changed from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-server.changes branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp - copied, changed from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiServer.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server.desktop - copied unchanged from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.desktop branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server.ycp - copied, changed from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_auto.ycp - copied, changed from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_auto.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_proposal.ycp - copied, changed from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_proposal.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/yast2-iscsi-lio-server.spec.in Removed: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-server.changes branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiServer.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.desktop branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_auto.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_proposal.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/yast2-iscsi-server.spec.in Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/RPMNAME branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/VERSION branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/Makefile.am branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/complex.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/dialogs.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/helps.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/widgets.ycp branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/wizards.ycp Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/RPMNAME URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/RPMNAME?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/RPMNAME (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/RPMNAME Wed Mar 28 11:54:25 2012 @@ -1 +1 @@ -yast2-iscsi-server +yast2-iscsi-lio-server Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/VERSION?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/VERSION Wed Mar 28 11:54:25 2012 @@ -1 +1 @@ -2.17.10 +2.17.1 Copied: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-lio-server.changes (from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-server.changes) URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-lio-server.changes?p2=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-lio-server.changes&p1=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-server.changes&r1=67726&r2=67728&rev=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-server.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/package/yast2-iscsi-lio-server.changes Wed Mar 28 11:54:25 2012 @@ -1,284 +1,7 @@ ------------------------------------------------------------------- -Thu Aug 4 14:02:26 CEST 2011 - fehr@suse.de +Tue Mar 27 19:57:31 CEST 2012 - fehr@suse.de -- do not remove tgt package, just stop and disable tgtd service, - this way possible tgt config files do not get lost (bnc#706580) -- 2.17.10 +- 2.17.1 +- initial version of iscsi-lio-server ------------------------------------------------------------------- -Thu Jun 30 16:16:50 CEST 2011 - fehr@suse.de - -- fix typos in translatable texts (bnc#703125) - -------------------------------------------------------------------- -Mon May 16 11:29:53 CEST 2011 - fehr@suse.de - -- allow only integer values in lun input field (bnc#693683) -- 2.17.9 - -------------------------------------------------------------------- -Tue Nov 3 12:52:14 CET 2009 - mzugec@suse.cz - -- export credentials for target (fate#301932) -- 2.17.8 - -------------------------------------------------------------------- -Thu May 21 09:19:02 CEST 2009 - mzugec@suse.cz - -- handle correctly when tgt is already installed (bnc#501375) -- 2.17.7 - -------------------------------------------------------------------- -Mon Mar 23 17:51:33 CET 2009 - mzugec@suse.de - -- correctly work with firewall (bnc#462006) -- 2.17.6 - -------------------------------------------------------------------- -Mon Mar 23 17:49:21 CET 2009 - mzugec@suse.de - -- handle exceptions - thanks to ajohansson@novell.com (bnc#481379) -- 2.17.5 - -------------------------------------------------------------------- -Fri Dec 5 10:51:24 CET 2008 - mzugec@suse.cz - -- align button (bnc#447558) -- 2.17.4 - -------------------------------------------------------------------- -Mon Nov 10 16:09:30 CET 2008 - mzugec@suse.cz - -- fixed iSNS option problem (bnc#442670) -- 2.17.3 - -------------------------------------------------------------------- -Mon Sep 29 09:18:47 CEST 2008 - mzugec@suse.de - -- fixed menu category for gnome (bnc#429431) -- 2.17.2 - -------------------------------------------------------------------- -Mon Sep 8 13:05:01 CEST 2008 - mzugec@suse.cz - -- proofread -- 2.17.1 - -------------------------------------------------------------------- -Fri Sep 5 15:20:34 CEST 2008 - mzugec@suse.cz - -- changed rpm description - -------------------------------------------------------------------- -Fri May 16 16:40:22 CEST 2008 - jsrain@suse.cz - -- added categories Settings and System into desktop file - (bnc #382778) - -------------------------------------------------------------------- -Mon Mar 17 12:43:32 CET 2008 - jsrain@suse.cz - -- added 'StartupNotify=true' to the desktop file (bnc #304964) -- 2.16.1 - -------------------------------------------------------------------- -Mon Feb 24 15:55:37 CET 2008 - mzugec@suse.de - -- check if network is running -- 2.16.0 - -------------------------------------------------------------------- -Thu Jan 10 19:19:10 CET 2008 - mzugec@suse.cz - -- added iSNS support (FaTE #302083) -- 2.14.4 - -------------------------------------------------------------------- -Fri Nov 9 10:29:58 CET 2007 - mzugec@suse.cz - -- fixed description in file dialogs - -------------------------------------------------------------------- -Tue Mar 6 12:51:49 CET 2007 - mzugec@suse.cz - -- iscsi-server writes to stdout (#250628) - -------------------------------------------------------------------- -Wed Feb 7 16:27:01 CET 2007 - mzugec@suse.de - -- disable edit and delete buttons in empty table (#241804) -- 2.14.3 - -------------------------------------------------------------------- -Tue Feb 6 10:39:19 CET 2007 - mzugec@suse.de - -- remove spaces as separators between parameters in /etc/ietd.conf (#239555) -- 2.14.2 - -------------------------------------------------------------------- -Mon Jan 15 16:37:54 CET 2007 - mzugec@suse.cz - -- fate #300631 - Support Several LUNs for Target - -------------------------------------------------------------------- -Thu Jun 1 10:55:13 CEST 2006 - mzugec@suse.cz - -- fixed #180205 - because of gettext problem, - one string wasn't mark for translation -- 2.14.0 - -------------------------------------------------------------------- -Fri May 19 16:43:52 CEST 2006 - mzugec@suse.cz - -- fixed #177060 incorrect storing data between dialogs - -------------------------------------------------------------------- -Thu May 18 15:31:47 CEST 2006 - mzugec@suse.cz - -- fixed #176724 - duplicates configuration entry - -------------------------------------------------------------------- -Thu May 18 13:10:49 CEST 2006 - mzugec@suse.cz - -- fixed #148968 - do not restart unchanged targets - -------------------------------------------------------------------- -Wed May 17 17:48:38 CEST 2006 - mzugec@suse.cz - -- fixed #176186 - service status after YaST2 exit - -------------------------------------------------------------------- -Tue May 9 11:18:05 CEST 2006 - mzugec@suse.cz - -- fixed #173818 - support for autoyast - -------------------------------------------------------------------- -Mon Apr 24 11:13:41 CEST 2006 - mzugec@suse.cz - -- fixed #168732 - deleted values from auth are stored - -------------------------------------------------------------------- -Mon Apr 24 08:37:10 CEST 2006 - mzugec@suse.cz - -- comments, logs, testsuite - -------------------------------------------------------------------- -Tue Apr 11 12:58:08 CEST 2006 - mzugec@suse.cz - -- fixed #157643 - reload server - -------------------------------------------------------------------- -Fri Apr 7 08:26:27 CEST 2006 - mzugec@suse.cz - -- fixed #163999 - iscsi target - identifier contains '\n' - -------------------------------------------------------------------- -Wed Apr 5 17:50:29 CEST 2006 - mzugec@suse.cz - -- fixed #157648 - when modify target, can edit LUN - -------------------------------------------------------------------- -Wed Apr 5 17:16:42 CEST 2006 - mzugec@suse.cz - -- fixed #163299 - Iscsi->iSCSI - -------------------------------------------------------------------- -Wed Apr 5 17:06:10 CEST 2006 - mzugec@suse.cz - -- fixed #158546 cannot set the same user/pass fot incoming and outgoing auth - -------------------------------------------------------------------- -Thu Mar 23 16:11:20 CET 2006 - mzugec@suse.cz - -- fixed #160315 - check if user is root - -------------------------------------------------------------------- -Tue Mar 21 09:23:22 CET 2006 - mzugec@suse.cz - -- changed group to Net_advanced - -------------------------------------------------------------------- -Fri Mar 17 18:54:54 CET 2006 - mzugec@suse.cz - -- fixed #158540 - hide passwords - -------------------------------------------------------------------- -Thu Mar 16 17:20:11 CET 2006 - mzugec@suse.cz - -- fixed #158538 - write before restart server - -------------------------------------------------------------------- -Tue Mar 14 14:49:37 CET 2006 - mzugec@suse.cz - -- fixed #157645 LUN counting starts from zero - -------------------------------------------------------------------- -Tue Mar 14 14:40:49 CET 2006 - mzugec@suse.cz - -- fixed #157653 - use UUID with iqn - -------------------------------------------------------------------- -Mon Mar 6 10:26:07 CET 2006 - mzugec@suse.cz - -- #155273 - IscsiServer -> Iscsi Target - -------------------------------------------------------------------- -Fri Feb 24 14:54:03 CET 2006 - mzugec@suse.cz - -- fixed #152916 - immediately write configuration in Write() - -------------------------------------------------------------------- -Tue Feb 21 11:19:50 CET 2006 - mzugec@suse.cz - -- workarround for #148968 - warning before restart server, proofread - -------------------------------------------------------------------- -Fri Feb 17 14:42:23 CET 2006 - mzugec@suse.cz - -- fixed #149050 - enable/disable firewall - -------------------------------------------------------------------- -Wed Feb 15 13:20:10 CET 2006 - mzugec@suse.cz - -- improved #148971 - remove \n - -------------------------------------------------------------------- -Tue Feb 14 10:23:03 CET 2006 - mzugec@suse.cz - -- fixed #148971 - offer iqn - -------------------------------------------------------------------- -Thu Feb 9 14:01:04 CET 2006 - mzugec@suse.cz - -- fixed #149034 - service start - -------------------------------------------------------------------- -Mon Feb 6 14:05:54 CET 2006 - mvidner@suse.cz - -- Authentication fix (mzugec) -- 2.13.4 - -------------------------------------------------------------------- -Tue Jan 31 12:45:38 CET 2006 - mzugec@suse.cz - -- new dialogs - -------------------------------------------------------------------- -Mon Jan 23 11:06:20 CET 2006 - mzugec@suse.cz - -- fixed general params - -------------------------------------------------------------------- -Mon Jan 16 18:58:45 CET 2006 - mzugec@suse.cz - -- changed specfile - -------------------------------------------------------------------- -Mon Jan 16 18:44:30 CET 2006 - mzugec@suse.cz - -- without write, without modify - -------------------------------------------------------------------- -Wed Jan 11 15:39:03 2006 - mzugec@suse.cz - -- initial version Copied: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp (from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiServer.ycp) URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp?p2=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp&p1=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiServer.ycp&r1=67726&r2=67728&rev=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiServer.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp Wed Mar 28 11:54:25 2012 @@ -1,19 +1,19 @@ /** - * File: modules/IscsiServer.ycp - * Package: Configuration of iscsi-server - * Summary: IscsiServer settings, input and output functions - * Authors: Michal Zugec <mzugec@suse.cz> + * File: modules/IscsiLioServer.ycp + * Package: Configuration of iscsi-lio-server + * Summary: IscsiLioServer settings, input and output functions + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ * - * Representation of the configuration of iscsi-server. + * Representation of the configuration of iscsi-lio-server. * Input and output routines. */ { -module "IscsiServer"; -textdomain "iscsi-server"; +module "IscsiLioServer"; +textdomain "iscsi-lio-server"; import "Progress"; import "Report"; @@ -24,7 +24,7 @@ import "Popup"; import "SuSEFirewall"; import "Confirm"; -import "IscsiServerFunctions"; +import "IscsiLioData"; import "Mode"; import "NetworkService"; import "PackageSystem"; @@ -83,7 +83,7 @@ -// Settings: Define all variables needed for configuration of iscsi-server +// Settings: Define all variables needed for configuration of iscsi-lio-server // TODO FIXME: Define all the variables necessary to hold // TODO FIXME: the configuration here (with the appropriate // TODO FIXME: description) @@ -98,39 +98,32 @@ // read configuration file /etc/ietd.conf global boolean readConfig(){ - map<string, any> read_values = (map<string, any>)SCR::Read(.etc.ietd.all); - IscsiServerFunctions::parseConfig( read_values ); + IscsiLioData::SetData( IscsiLioData::ParseConfigLio() ); return true; } +// read configuration file /etc/ietd.conf +global map readIetdConfig(){ + map<string, any> read_values = (map<string, any>)SCR::Read(.etc.ietd.all); + return IscsiLioData::ParseConfigIetd( read_values ); +} + +global boolean activateIetdConfig( map ietd ){ + return IscsiLioData::ActivateConfigIetd( ietd ); +} -// write configuration file /etc/ietd.conf -boolean writeConfig(){ - // prepare map, because perl->ycp lost information about data types (integers in this case) - map <string, any> config_file = IscsiServerFunctions::writeConfig(); - config_file["type"]=tointeger(config_file["type"]:"1"); - config_file["file"]=tointeger(config_file["file"]:"1"); - list <map<string, any> > value = []; - foreach(map<string, any> row, config_file["value"]:[], { - row["type"]=tointeger(row["type"]:"1"); - row["file"]=tointeger(row["file"]:"1"); - value = add(value, row); - }); - config_file["value"] = value; - y2milestone("config_file to write %1", config_file); - // write it - SCR::Write(.etc.ietd.all, config_file); - SCR::Write(.etc.ietd, nil); +// dummy function since LIO has no config file +boolean writeConfig(){ return true; } -// test if required package ("iscsitarget") is installed +// test if required package ("lio-utils") is installed boolean installed_packages(){ - if (!PackageSystem::PackageInstalled("iscsitarget")){ + if (!PackageSystem::PackageInstalled("lio-utils")){ y2milestone("Not installed, will install"); boolean confirm = Popup::AnyQuestionRichText( - "", _("Can't continue without installing iscsitarget package"), 40, 10, + "", _("Can't continue without installing lio-utils package"), 40, 10, Label::InstallButton(), Label::CancelButton (), `focus_yes ); @@ -138,24 +131,27 @@ string service = "tgtd"; if (Service::Status(service)==0) Service::Stop(service); Service::Disable(service); - PackageSystem::DoInstall(["iscsitarget"]); - if (PackageSystem::PackageInstalled("iscsitarget")) return true; + service = "iscsitarget"; + if (Service::Status(service)==0) Service::Stop(service); + Service::Disable(service); + PackageSystem::DoInstall(["lio-utils"]); + if (PackageSystem::PackageInstalled("lio-utils")) return true; else return false; } return false; } else return true; } -// check status of iscsitarget service +// check status of target service // if not enabled, start it manually boolean getServiceStatus(){ boolean ret = true; - if (Service::Status("iscsitarget") == 0) { + if (Service::Status("target") == 0) { statusOnStart=true; serviceStatus=true; } y2milestone("Service status = %1", statusOnStart); - if (!statusOnStart) Service::Start("iscsitarget"); + if (!statusOnStart) Service::Start("target"); return ret; } @@ -165,12 +161,12 @@ if (!serviceStatus) start = statusOnStart; if (!start) { - y2milestone("Stop iscsitarget service"); - Service::Stop("iscsitarget"); + y2milestone("Stop target service"); + Service::Stop("target"); } else { - y2milestone("Start iscsitarget service"); + y2milestone("Start target service"); serviceStatus=true; - Service::Start("iscsitarget"); + Service::Start("target"); } return true; } @@ -182,12 +178,12 @@ if (Popup::YesNo(_( "If changes have been made, the iSCSI target is not able to reload current configuration. It can only restart. When restarting, all sessions are aborted. -Restart the iscsitarget service? -"))) Service::Restart("iscsitarget"); +Restart the target service? +"))) Service::Restart("target"); else { // get changes from perl module - map<string, any> changes = IscsiServerFunctions::getChanges(); - list<string> connected = IscsiServerFunctions::getConnected(); + map<string, any> changes = IscsiLioData::GetChanges(); + list<string> connected = IscsiLioData::GetConnected(); // plus add there all targets except with active sessions (it means delete and create as new each target) /* foreach(string key,any value, IscsiServerFunctions::getTargets(), { @@ -225,7 +221,7 @@ list<string> lun = []; list <string> secret = []; // add authentication to target - foreach( map<string, any> conf_row, (list<map<string, any> >) IscsiServerFunctions::getConfig()[row]:[], { + foreach( map<string, any> conf_row, (list<map<string, any> >) IscsiLioData::GetConfig()[row]:[], { switch (conf_row["KEY"]:""){ case("Lun") : lun = splitstring(conf_row["VALUE"]:"", " "); break; @@ -252,13 +248,13 @@ /** - * Read all iscsi-server settings + * Read all iscsi-lio-server settings * @return true on success */ global boolean Read() { - /* IscsiServer read dialog caption */ - string caption = _("Initializing iSCSI Target Configuration"); + /* IscsiLioServer read dialog caption */ + string caption = _("Initializing LIO iSCSI Target Configuration"); // TODO FIXME Set the right number of stages integer steps = 4; @@ -292,22 +288,36 @@ if(!Confirm::MustBeRoot()) return false; if(!NetworkService::RunningNetworkPopup()) return false; Progress::NextStage(); - // check if required packages ("iscsitarget") are installed + // check if required packages ("lio-utils") are installed if(!installed_packages()) return false; sleep(sl); if(Abort()) return false; Progress::NextStep(); - // get status of iscsitarget init script + // get status of target init script if(!getServiceStatus()) return false; sleep(sl); if(Abort()) return false; Progress::NextStage(); // read configuration (/etc/ietd.conf) - if(!readConfig()) { - Report::Error(Message::CannotReadCurrentSettings()); - return false; + readConfig(); + if(size(IscsiLioData::GetTargets())==0) + { + map ietd = readIetdConfig(); + string msg = _( +"You have currently no active LIO targets but there seems +to be a valid config in /etc/ietd.conf. Should the module +try to import setting from /etc/ietd.conf into LIO?" ); + if( size(ietd["tgt"]:$[])>0 && Report::yesno_message_settings["show"]:true && + Popup::YesNo( msg )) + { + if( !activateIetdConfig( ietd )) + { + string err = _( "Errors during import. Check LIO state!" ); + Report::Error( err ); + } + } } sleep(sl); @@ -333,13 +343,13 @@ } /** - * Write all iscsi-server settings + * Write all iscsi-lio-server settings * @return true on success */ global boolean Write() { - /* IscsiServer write dialog caption */ - string caption = _("Saving iSCSI Target Configuration"); + /* IscsiLioServer write dialog caption */ + string caption = _("Saving iSCSI LIO Target Configuration"); // TODO FIXME And set the right number of stages integer steps = 2; @@ -371,8 +381,6 @@ Progress::set(true); Progress::NextStage(); - // write configuration (/etc/ietd.conf) - if(!writeConfig()) Report::Error (_("Cannot write settings.")); sleep(sl); @@ -387,13 +395,13 @@ Progress::NextStage(); sleep(sl); - // set iscsitarget initscript status + // set target initscript status if(!setServiceStatus()) return false; return true; } /** - * Get all iscsi-server settings from the first parameter + * Get all iscsi-lio-server settings from the first parameter * (For use by autoinstallation.) * @param settings The YCP structure to be imported. * @return boolean True on success @@ -411,11 +419,11 @@ if (row["KEY"]:""=="IncomingUser") incom = add(incom, row["VALUE"]:""); else outgoin = row["VALUE"]:""; }); - IscsiServerFunctions::setAuth(incom, outgoin); - break; + IscsiLioData::SetAuth("",0,incom, outgoin); + break; case("targets") : string name = ""; - list<map<string, any> > lun = []; + list<string> lun = []; list<string> inc = []; string out = ""; foreach(list< map<string, any> > val, (list<list<map<string, any> > >)value, { @@ -423,13 +431,19 @@ lun=[]; inc=[]; out=""; + integer tpg = 1; foreach(map<string, any> row, val, { switch(row["KEY"]:""){ case("Target"): name = row["VALUE"]:""; break; + case("Tpg"): + tpg = tointeger(row["VALUE"]:"1"); + if( tpg==nil ) + tpg = 1; + break; case("Lun"): - lun = add(lun, row); + lun = add(lun, row["VALUE"]:""); break; case("IncomingUser"): inc = add(inc, row["VALUE"]:""); @@ -439,8 +453,8 @@ break; } }); - IscsiServerFunctions::addNewTarget(name, lun); - IscsiServerFunctions::setTargetAuth(name, inc, out); + IscsiLioData::AddNewTarget(name, tpg, lun); + IscsiLioData::SetAuth(name, tpg, inc, out); }); break; } @@ -451,95 +465,85 @@ } /** - * Dump the iscsi-server settings to a single map + * Dump the iscsi-lio-server settings to a single map * (For use by autoinstallation.) * @return map Dumped settings (later acceptable by Import ()) */ global map Export () { list targets = []; - foreach(string k, any v, IscsiServerFunctions::getTargets(), { + foreach(string k, any v, IscsiLioData::GetExportTargets(), { targets = add(targets, v); }); map result = $[ "version" : "1.0", "service" : serviceStatus, - "auth" : IscsiServerFunctions::getConfig()["auth"]:[], + "auth" : IscsiLioData::GetExportAuth("",0), "targets" : targets ]; configured = true; return result; } -boolean noAuth(list<map<string,any> > config){ - boolean ret = true; - foreach(map<string, any> row, config, { - if (row["KEY"]:""=="IncomingUser" || row["KEY"]:""=="OutgoingUser") ret=false; - }); - return ret; -} - -boolean authIn(list<map<string,any> > config){ - boolean ret = false; - foreach(map<string, any> row, config, { - if (row["KEY"]:""=="IncomingUser") ret=true; - }); - return ret; -} - -boolean authOut(list<map<string,any> > config){ - boolean ret = false; - foreach(map<string, any> row, config, { - if (row["KEY"]:""=="OutgoingUser") ret=true; - }); - return ret; -} - -string getLun(list<map<string,any> > config){ - string ret = ""; - foreach(map<string, any> row, config, { - if (row["KEY"]:""=="Lun") ret=row["VALUE"]:""; - }); - return ret; -} +string getLunDesc(map<integer,map> lun) + { + string ret = ""; + foreach(integer l, map m, lun, + { + if( size(ret)>0 ) + ret = ret + ", "; + ret = ret + IscsiLioData::GetExportLun( l, m ); + }); + return ret; + } /** * Create a textual summary and a list of unconfigured cards * @return summary of the current configuration */ -global list Summary() { - string summary = _("Configuration summary..."); - if (configured){ +global list Summary() + { + string summary = _("Configuration summary..."); + if (configured) + { summary = Summary::AddHeader("", _("Global")); - if (serviceStatus) summary = Summary::AddLine(summary, _("When Booting")); - else summary = Summary::AddLine(summary, _("Manually")); - if (noAuth(IscsiServerFunctions::getConfig()["auth"]:[])) summary = Summary::AddLine(summary, _("No Authentication")); - else { - if(authIn(IscsiServerFunctions::getConfig()["auth"]:[])) summary = Summary::AddLine(summary, _("Incoming Authentication")); - if(authOut(IscsiServerFunctions::getConfig()["auth"]:[])) summary = Summary::AddLine(summary, _("Outgoing Authentication")); - } + if (serviceStatus) + summary = Summary::AddLine(summary, _("When Booting")); + else + summary = Summary::AddLine(summary, _("Manually")); + if( !IscsiLioData::HasAuth( "",0 )) + summary = Summary::AddLine(summary, _("No Authentication")); + else + { + if(IscsiLioData::HasIncomingAuth("",0)) summary = Summary::AddLine(summary, _("Incoming Authentication")); + if(IscsiLioData::HasOutgoingAuth("",0)) summary = Summary::AddLine(summary, _("Outgoing Authentication")); + } summary = Summary::AddHeader(summary, _("Targets")); summary = Summary::OpenList(summary); - foreach(string key, any value, IscsiServerFunctions::getTargets(), { - summary = Summary::AddListItem(summary, key); - summary = Summary::AddLine(summary, getLun((list<map<string, any> >)value)); - if (noAuth((list<map<string, any> >)value)) summary = Summary::AddLine(summary, _("No Authentication")); - else { - if(authIn((list<map<string, any> >)value)) summary = Summary::AddLine(summary, _("Incoming Authentication")); - if(authOut((list<map<string, any> >)value)) summary = Summary::AddLine(summary, _("Outgoing Authentication")); - } - - }); + foreach(list keys, IscsiLioData::GetTargets(), + { + summary = Summary::AddListItem(summary, keys[0]:""); + summary = Summary::AddLine(summary, getLunDesc(IscsiLioData::GetLun(keys[0]:"",keys[1]:1))); + if (!IscsiLioData::HasAuth(keys[0]:"",keys[1]:1)) + summary = Summary::AddLine(summary, _("No Authentication")); + else + { + if(IscsiLioData::HasIncomingAuth(keys[0]:"",keys[1]:1)) + summary = Summary::AddLine(summary, _("Incoming Authentication")); + if(IscsiLioData::HasOutgoingAuth(keys[0]:"",keys[1]:1)) + summary = Summary::AddLine(summary, _("Outgoing Authentication")); + } + }); summary = Summary::CloseList(summary); - - - } else { + } + else + { summary = Summary::NotConfigured(); } // TODO FIXME: your code here... /* Configuration summary text for autoyast */ return [ summary, [] ]; -} + } /** * Create an overview table with all configured cards @@ -564,16 +568,16 @@ // get/set service accessors for CWMService component global boolean GetStartService() { - boolean status = Service::Enabled("iscsitarget"); - y2milestone("iscsitarget service status %1", status); + boolean status = Service::Enabled("target"); + y2milestone("target service status %1", status); return status; } global void SetStartService(boolean status) { y2milestone("Set service status %1", status); serviceStatus = status; - if (status == true) Service::Enable("iscsitarget"); - else Service::Disable("iscsitarget"); + if (status == true) Service::Enable("target"); + else Service::Disable("target"); } Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/Makefile.am?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/Makefile.am (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/Makefile.am Wed Mar 28 11:54:25 2012 @@ -1,11 +1,11 @@ # Makefile.am for iscsi-server/src -yncludedir = @yncludedir@/iscsi-server +yncludedir = @yncludedir@/iscsi-lio-server client_DATA = \ - iscsi-server.ycp \ - iscsi-server_auto.ycp \ - iscsi-server_proposal.ycp + iscsi-lio-server.ycp \ + iscsi-lio-server_auto.ycp \ + iscsi-lio-server_proposal.ycp ynclude_DATA = \ helps.ycp \ @@ -15,10 +15,11 @@ widgets.ycp desktop_DATA = \ - iscsi-server.desktop + iscsi-lio-server.desktop module_DATA = \ - IscsiServer.ycp \ + IscsiLioServer.ycp \ + IscsiLioData.ycp \ IscsiServerFunctions.pm EXTRA_DIST = $(client_DATA) $(ynclude_DATA) $(module_DATA) $(desktop_DATA) Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/complex.ycp?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/complex.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/complex.ycp Wed Mar 28 11:54:25 2012 @@ -1,34 +1,34 @@ /** - * File: include/iscsi-server/complex.ycp - * Package: Configuration of iscsi-server + * File: include/iscsi-lio-server/complex.ycp + * Package: Configuration of iscsi-lio-server * Summary: Dialogs definitions - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ */ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; import "Label"; import "Popup"; import "Wizard"; import "Wizard_hw"; -import "IscsiServer"; +import "IscsiLioServer"; -include "iscsi-server/helps.ycp"; +include "iscsi-lio-server/helps.ycp"; /** * Return a modification status * @return true if data was modified */ boolean Modified() { - return IscsiServer::Modified(); + return IscsiLioServer::Modified(); } boolean ReallyAbort() { - return !IscsiServer::Modified() || Popup::ReallyAbort(true); + return !IscsiLioServer::Modified() || Popup::ReallyAbort(true); } boolean PollAbort() { @@ -41,8 +41,8 @@ */ symbol ReadDialog() { Wizard::RestoreHelp(HELPS["read"]:""); - // IscsiServer::AbortFunction = PollAbort; - boolean ret = IscsiServer::Read(); + // IscsiLioServer::AbortFunction = PollAbort; + boolean ret = IscsiLioServer::Read(); return ret ? `next : `abort; } @@ -52,8 +52,8 @@ */ symbol WriteDialog() { Wizard::RestoreHelp(HELPS["write"]:""); - // IscsiServer::AbortFunction = PollAbort; - boolean ret = IscsiServer::Write(); + // IscsiLioServer::AbortFunction = PollAbort; + boolean ret = IscsiLioServer::Write(); return ret ? `next : `abort; } Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/dialogs.ycp?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/dialogs.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/dialogs.ycp Wed Mar 28 11:54:25 2012 @@ -1,34 +1,29 @@ /** - if (size((list)UI::QueryWidget(`server, `Items))==0){ - UI::ChangeWidget(`edit, `Enabled, false); - UI::ChangeWidget(`delete, `Enabled, false); - } else { - UI::ChangeWidget(`edit, `Enabled, true); - UI::ChangeWidget(`delete, `Enabled, true); - } - * File: include/iscsi-server/dialogs.ycp - * Package: Configuration of iscsi-server + * File: include/iscsi-lio-server/dialogs.ycp + * Package: Configuration of iscsi-lio-server * Summary: Dialogs definitions - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ */ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; import "Label"; +import "String"; import "Wizard"; -import "IscsiServer"; +import "IscsiLioServer"; +import "IscsiLioData"; import "CWMTab"; import "CWM"; import "CWMServiceStart"; import "CWMFirewallInterfaces"; import "TablePopup"; -include "iscsi-server/helps.ycp"; -include "iscsi-server/widgets.ycp"; +include "iscsi-lio-server/helps.ycp"; +include "iscsi-lio-server/widgets.ycp"; // store current here string current_tab = "service"; @@ -46,8 +41,6 @@ `VBox( "auto_start_up", `VSpacing (2), - "isns", - `VSpacing (2), "firewall", `VSpacing (2), "save", @@ -58,7 +51,7 @@ ), `VStretch() ), - "widget_names" : [ "auto_start_up", "isns", "firewall", "save" ] + "widget_names" : [ "auto_start_up", "firewall", "save" ] ], // second tab - global authentication "global":$[ @@ -102,26 +95,31 @@ ], "target-details":$[ "contents" : - `VBox( + `HBox( + `HWeight( 2, `Empty() ), + `HWeight( 4, + `VBox( `HBox( - `InputField(`id(`target), `opt(`hstretch), _("Target"), "iqn.2001-04.com.example"), - `InputField(`id(`identifier), `opt(`hstretch), _("Identifier"), "test") - ), - `VBox( - `Table(`id(`lun_table), - `header(_("LUN"), _("Value")), - [] - ), - `Left( - `HBox( - `PushButton(`id(`add), _("Add")), - `PushButton(`id(`edit), _("Edit")), - `PushButton(`id(`delete), _("Delete")) - ) - ) - ), - `Left( `PushButton(`id(`expert),`opt(`disabled), _("Expert Settings")) ) - ), + `HWeight(3,`InputField(`id(`target), `opt(`hstretch), _("Target"), "iqn.2001-04.com.example")), + `HWeight(3,`InputField(`id(`identifier), `opt(`hstretch), _("Identifier"), "test")), + `HWeight(1,`InputField(`id(`tpg), _("Portal group"), "1")) + ), + `HBox( + `HWeight(3,`ComboBox(`id(`ipaddr), `opt(`hstretch), _("Ip address"), + IscsiLioData::GetIpAddr())), + `HWeight(1,`InputField(`id(`port), _("Port number"), "3260")) + ), + `Table(`id(`lun_table), + `header(_("LUN"), _("Name"), _("Path")), []), + `Left( + `HBox( + `PushButton(`id(`add), _("Add")), + `PushButton(`id(`edit), _("Edit")), + `PushButton(`id(`delete), _("Delete")) + )), + `Left( `PushButton(`id(`expert),`opt(`disabled), _("Expert Settings")) ) + )), + `HWeight( 2, `Empty() )) ], "auth": $[ @@ -157,16 +155,16 @@ map<string, map <string, any> > widgets = $[ "auto_start_up" : CWMServiceStart::CreateAutoStartWidget ($[ - "get_service_auto_start" : IscsiServer::GetStartService, - "set_service_auto_start" : IscsiServer::SetStartService, + "get_service_auto_start" : IscsiLioServer::GetStartService, + "set_service_auto_start" : IscsiLioServer::SetStartService, // radio button (starting iscsitarget service - option 1) "start_auto_button" : _("When &Booting"), - // radio button (starting iscsitarget service - option 2) + // radio button (starting LIO target service - option 2) "start_manual_button" : _("&Manually"), "help" : sformat (CWMServiceStart::AutoStartHelpTemplate (), - // part of help text, used to describe radiobuttons (matching starting iscsitarget service but without "&") + // part of help text, used to describe radiobuttons (matching starting LIO target service but without "&") _("When Booting"), - // part of help text, used to describe radiobuttons (matching starting iscsitarget service but without "&") + // part of help text, used to describe radiobuttons (matching starting LIO target service but without "&") _("Manually") ), ]), @@ -216,7 +214,7 @@ "custom_widget" : `VBox( `Table(`id(`server), - `header(_("Targets")), + `header(_("Targets"), `Right(_("Portal group"))), []), `Left( `HBox( @@ -268,17 +266,6 @@ "help" : HELPS["expert"]:"" ], - // dialog for LUN details -/* - "lun-details" : $[ - "widget" : `custom, - "custom_widget" : tabs_descr["lun-details", "contents"]:nil, -// "init" : initLUN, - "handle" : handleLUN, - "store" : storeLUN, - "help" : HELPS["lun-details"]:"" - ], -*/ // dialog for add/edit authentication for target "target-auth" : $[ "widget" : `custom, @@ -311,7 +298,7 @@ */ // Main dialog - tabbed any SummaryDialog() { - string caption = _("iSCSI Target Overview"); + string caption = _("LIO iSCSI Target Overview"); curr_target = ""; map widget_descr = $[ "tab": CWMTab::CreateWidget($[ Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/helps.ycp?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/helps.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/helps.ycp Wed Mar 28 11:54:25 2012 @@ -1,15 +1,15 @@ /** - * File: include/iscsi-server/helps.ycp - * Package: Configuration of iscsi-server + * File: include/iscsi-lio-server/helps.ycp + * Package: Configuration of iscsi-lio-server * Summary: Help texts of all the dialogs - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ */ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; /** * All helps are here @@ -17,7 +17,7 @@ map HELPS = $[ /* Read dialog help 1/2 */ - "read" : _("<p><b><big>Initializing iSCSI Target Configuration</big></b><br> + "read" : _("<p><b><big>Initializing iSCSI LIO Target Configuration</big></b><br> Please wait...<br></p> ") + Copied: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server.ycp (from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.ycp) URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server.ycp?p2=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server.ycp&p1=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.ycp&r1=67726&r2=67728&rev=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server.ycp Wed Mar 28 11:54:25 2012 @@ -1,40 +1,40 @@ /** - * File: clients/iscsi-server.ycp - * Package: Configuration of iscsi-server + * File: clients/iscsi-lio-server.ycp + * Package: Configuration of iscsi-lio-server * Summary: Main file - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ * - * Main file for iscsi-server configuration. Uses all other files. + * Main file for iscsi-lio-server configuration. Uses all other files. */ { /*** - * <h3>Configuration of iscsi-server</h3> + * <h3>Configuration of iscsi-lio-server</h3> */ -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; /* The main () */ y2milestone ("----------------------------------------"); -y2milestone ("IscsiServer module started"); +y2milestone ("IscsiLioServer module started"); import "Progress"; import "Report"; import "Summary"; import "CommandLine"; -include "iscsi-server/wizards.ycp"; +include "iscsi-lio-server/wizards.ycp"; map cmdline_description = $[ - "id" : "iscsi-server", - /* Command line help text for the Xiscsi-server module */ - "help" : _("Configuration of an iSCSI target"), - "guihandler" : IscsiServerSequence, - "initialize" : IscsiServer::Read, - "finish" : IscsiServer::Write, + "id" : "iscsi-lio-server", + /* Command line help text for the iscsi-lio-server module */ + "help" : _("Configuration of an iSCSI target via LIO"), + "guihandler" : IscsiLioServerSequence, + "initialize" : IscsiLioServer::Read, + "finish" : IscsiLioServer::Write, "actions" : $[ // FIXME TODO: fill the functionality description here ], @@ -59,12 +59,12 @@ /* main ui function */ any ret = nil; -if(propose) ret = IscsiServerAutoSequence(); +if(propose) ret = IscsiLioServerAutoSequence(); else ret = CommandLine::Run(cmdline_description); y2debug("ret=%1", ret); /* Finish */ -y2milestone("IscsiServer module finished"); +y2milestone("IscsiLioServer module finished"); y2milestone("----------------------------------------"); return ret; Copied: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_auto.ycp (from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_auto.ycp) URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_auto.ycp?p2=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_auto.ycp&p1=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_auto.ycp&r1=67726&r2=67728&rev=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_auto.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_auto.ycp Wed Mar 28 11:54:25 2012 @@ -1,8 +1,8 @@ /** - * File: clients/iscsi-server_auto.ycp - * Package: Configuration of iscsi-server + * File: clients/iscsi-lio-server_auto.ycp + * Package: Configuration of iscsi-lio-server * Summary: Client for autoinstallation - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ * @@ -13,21 +13,21 @@ /** * @param function to execute - * @param map/list of iscsi-server settings + * @param map/list of iscsi-lio-server settings * @return map edited settings, Summary or boolean on success depending on called function * @example map mm = $[ "FAIL_DELAY" : "77" ]; - * @example map ret = WFM::CallFunction ("iscsi-server_auto", [ "Summary", mm ]); + * @example map ret = WFM::CallFunction ("iscsi-lio-server_auto", [ "Summary", mm ]); */ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; y2milestone("----------------------------------------"); -y2milestone("IscsiServer auto started"); +y2milestone("IscsiLioServer auto started"); -import "IscsiServer"; -include "iscsi-server/wizards.ycp"; +import "IscsiLioServer"; +include "iscsi-lio-server/wizards.ycp"; any ret = nil; string func = ""; @@ -44,50 +44,50 @@ /* Create a summary*/ if(func == "Summary") { - ret = select(IscsiServer::Summary(), 0, ""); + ret = IscsiLioServer::Summary()[0]:""; } /* Reset configuration */ else if (func == "Reset") { - IscsiServer::Import($[]); + IscsiLioServer::Import($[]); ret = $[]; } /* Change configuration (run AutoSequence) */ else if (func == "Change") { - ret = IscsiServerAutoSequence(); + ret = IscsiLioServerAutoSequence(); } /* Import configuration */ else if (func == "Import") { - ret = IscsiServer::Import(param); + ret = IscsiLioServer::Import(param); } /* Return actual state */ else if (func == "Export") { - ret = IscsiServer::Export(); + ret = IscsiLioServer::Export(); } /* Return needed packages */ else if (func == "Packages") { - ret = IscsiServer::AutoPackages(); + ret = IscsiLioServer::AutoPackages(); } /* Read current state */ else if (func == "Read") { import "Progress"; boolean progress_orig = Progress::set (false); - ret = IscsiServer::Read(); + ret = IscsiLioServer::Read(); Progress::set (progress_orig); } /* Write given settings */ else if (func == "Write") { import "Progress"; boolean progress_orig = Progress::set (false); - IscsiServer::write_only = true; - ret = IscsiServer::Write(); + IscsiLioServer::write_only = true; + ret = IscsiLioServer::Write(); Progress::set (progress_orig); } else if (func == "GetModified"){ - ret = IscsiServer::modified; + ret = IscsiLioServer::modified; } else if (func == "SetModified"){ - IscsiServer::modified = true; + IscsiLioServer::modified = true; ret = true; } /* Unknown function */ @@ -97,7 +97,7 @@ } y2debug("ret=%1", ret); -y2milestone("IscsiServer auto finished"); +y2milestone("IscsiLioServer auto finished"); y2milestone("----------------------------------------"); return ret; Copied: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_proposal.ycp (from r67726, branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_proposal.ycp) URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_proposal.ycp?p2=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_proposal.ycp&p1=branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_proposal.ycp&r1=67726&r2=67728&rev=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-server_proposal.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/iscsi-lio-server_proposal.ycp Wed Mar 28 11:54:25 2012 @@ -1,25 +1,25 @@ /** - * File: clients/iscsi-server_proposal.ycp - * Package: Configuration of iscsi-server + * File: clients/iscsi-lio-server_proposal.ycp + * Package: Configuration of iscsi-lio-server * Summary: Proposal function dispatcher. - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ * - * Proposal function dispatcher for iscsi-server configuration. + * Proposal function dispatcher for iscsi-lio-server configuration. * See source/installation/proposal/proposal-API.txt */ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; -import "IscsiServer"; +import "IscsiLioServer"; import "Progress"; /* The main () */ y2milestone("----------------------------------------"); -y2milestone("IscsiServer proposal started"); +y2milestone("IscsiLioServer proposal started"); string func = (string) WFM::Args(0); map param = (map) WFM::Args(1); @@ -32,13 +32,13 @@ symbol warning_level = nil; boolean force_reset = param["force_reset"]:false; - if(force_reset || !IscsiServer::proposal_valid) { - IscsiServer::proposal_valid = true; + if(force_reset || !IscsiLioServer::proposal_valid) { + IscsiLioServer::proposal_valid = true; boolean progress_orig = Progress::set (false); - IscsiServer::Read(); + IscsiLioServer::Read(); Progress::set (progress_orig); } - list sum = IscsiServer::Summary(); + list sum = IscsiLioServer::Summary(); proposal = sum[0]:""; ret = $[ @@ -49,9 +49,9 @@ } /* run the module */ else if(func == "AskUser") { - map stored = IscsiServer::Export(); - symbol seq = (symbol) WFM::CallFunction("iscsi-server", [.propose]); - if(seq != `next) IscsiServer::Import(stored); + map stored = IscsiLioServer::Export(); + symbol seq = (symbol) WFM::CallFunction("iscsi-lio-server", [.propose]); + if(seq != `next) IscsiLioServer::Import(stored); y2debug("stored=%1",stored); y2debug("seq=%1",seq); ret = $[ @@ -61,16 +61,16 @@ /* create titles */ else if(func == "Description") { ret = $[ - /* Rich text title for IscsiServer in proposals */ - "rich_text_title" : _("iSCSI Target"), - /* Menu title for IscsiServer in proposals */ - "menu_title" : _("&iSCSI Target"), - "id" : "iscsi-server", + /* Rich text title for IscsiLioServer in proposals */ + "rich_text_title" : _("iSCSI LIO Target"), + /* Menu title for IscsiLioServer in proposals */ + "menu_title" : _("&iSCSI LIO Target"), + "id" : "iscsi-lio-server", ]; } /* write the proposal */ else if(func == "Write") { - IscsiServer::Write(); + IscsiLioServer::Write(); } /* unknown function */ else { @@ -79,7 +79,7 @@ /* Finish */ y2debug("ret=%1",ret); -y2milestone("IscsiServer proposal finished"); +y2milestone("IscsiLioServer proposal finished"); y2milestone("----------------------------------------"); return ret; Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/widgets.ycp?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/widgets.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/widgets.ycp Wed Mar 28 11:54:25 2012 @@ -1,108 +1,120 @@ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; import "IscsiServerFunctions"; +import "IscsiLioData"; import "Label"; import "IP"; // **************** global funcions and variables ***** string curr_target = ""; +integer curr_tpg = 1; string modify_record = ""; map inc_auth = $[]; -map<string, any> parseRow(string value){ - map<string, any> ret=$[]; - // if nothing only LUN - if (find(value, " ")==-1){ - return $["lun":value]; - } - // extract Lun - integer pos=find(value, " "); - ret["lun"]=substring(value, 0, pos); - value=substring(value, pos, size(value)); - // extract Type - pos=find(value, "Type="); - integer pos2=findfirstof( substring(value, pos, size(value)), " ,"); - string type = substring(value, pos+size("Type="), (pos2!=nil)? pos2-size("Type=") : size(value)); - if (pos!=-1) - if (type=="fileio"){ ret["fileio"]=true; ret["nullio"]=false;} - else { ret["fileio"]=false; ret["nullio"]=true;} - // extract Path - pos=find(value, "Path="); - pos2=findfirstof( substring(value, pos, size(value)), " ,"); - if (pos!=-1) ret["path"] = substring(value, pos+size("Path="), (pos2!=nil)? pos2-size("Path=") : size(value)); - // extract ScsiId - pos=find(value, "ScsiId="); - pos2=findfirstof( substring(value, pos, size(value)), " ,"); - if (pos!=-1) ret["scsi_id"] = substring(value, pos+size("ScsiId="), (pos2!=nil)? pos2-size("ScsiId=") : size(value)); - // extract ScsiId - pos=find(value, "Sectors="); - pos2=findfirstof( substring(value, pos, size(value)), " ,"); - if (pos!=-1) ret["sectors"] = substring(value, pos+size("Sectors="), (pos2!=nil)? pos2-size("Sectors=") : size(value)); - return ret; -} +boolean CheckLun( integer l, list<term> other, boolean silent ) + { + string s = tostring(l); + boolean ret = size(filter( term i, other, ``(i[1]:""==s)))==0; + y2milestone( "CheckLun other:%1", other ); + y2milestone( "CheckLun l:%1 ret:%2", l, ret ); + if( !ret && !silent ) + Popup::Error( _("Selected Lun is already in use!") ); + return( ret ); + } +boolean CheckName( string n, list<term> other ) + { + boolean ret = size(filter( term i, other, ``(i[2]:""==n)))==0; + if( !ret ) + Popup::Error( _("Selected Name is already in use!") ); + return( ret ); + } -map <string, any> LUNDetailDialog(map<string, any> values_before){ - map<string, any> previous=parseRow(values_before["VALUE"]:""); - map <string, any> ret_map = $[]; - term lun_dialog = - `VBox( - `Left( `HWeight(3, `InputField( `id( `lun ), `opt(`hstretch), "LUN", previous["lun"]:"0" )) ), - `VSpacing(2), - `RadioButtonGroup(`id(`rb), `VBox( - `Left( `RadioButton(`id(`fileio), `opt(`notify), "Type=fileio", previous["fileio"]:true) ), - `HBox( - `InputField( `id( `file_path ), `opt(`hstretch), _("Path:"), previous["path"]:""), - `VBox( - `Label(""), - `PushButton(`id(`browse), _("Browse")) - ) - ), - `InputField( `id( `scsi_id ), `opt(`hstretch), "ScsiId:", previous["scsi_id"]:"" ), - `VSpacing(2), - - `Left( `RadioButton(`id(`nullio), `opt(`notify), "Type=nullio", previous["nullio"]:false) ), - `InputField( `id( `sectors ), `opt(`hstretch), _("Sectors:"), previous["sectors"]:"" ) - ) - ), - `Left( `HBox( `PushButton(`id(`ok), Label::OKButton() ), `PushButton(`id(`cancel), Label::CancelButton() ))) - ); - UI::OpenDialog(lun_dialog); - UI::ChangeWidget(`id(`lun), `ValidChars, "0123456789" ); - symbol ret = `nil; - while(ret != `ok && ret !=`cancel){ - boolean enable=false; - if ((boolean)UI::QueryWidget(`fileio, `Value)==true) enable=true; - - UI::ChangeWidget(`file_path, `Enabled, enable); - UI::ChangeWidget(`browse, `Enabled, enable); - UI::ChangeWidget(`scsi_id, `Enabled, enable); - UI::ChangeWidget(`sectors, `Enabled, !enable); - - if (ret == `browse){ - string file = UI::AskForExistingFile("/", "", _("Select file or device")); - if (file!=nil) UI::ChangeWidget(`file_path, `Value, file); - } - ret = (symbol)UI::UserInput(); - } - if (ret == `cancel) ret_map = $[]; - else { - string lun=(string)UI::QueryWidget(`lun, `Value); - string value=lun; - if ((boolean)UI::QueryWidget(`fileio, `Value)==true){ - value=sformat("%1 Path=%2,Type=fileio", value, (string)UI::QueryWidget(`file_path, `Value)); - string scsi_id=(string)UI::QueryWidget(`scsi_id, `Value); - if (size(scsi_id)>0) value=sformat("%1,ScsiId=%2", value, scsi_id); - } else { - value=sformat("%1 Type=nullio", value); - string sectors=(string)UI::QueryWidget(`sectors, `Value); - if (size(sectors)>0) value=sformat("%1,Sectors=%2", value, sectors); - } - ret_map = $["KEY":"Lun", "VALUE":value]; - } - UI::CloseDialog(); - return ret_map; -} +boolean CheckPath( string p, list<term> other ) + { + boolean ret = IscsiLioData::CheckPath( p )[0]:false; + if( !ret ) + Popup::Error( _("Selected Path must be either block device or normal file!") ); + if( ret && size(filter( term i, other, ``(i[3]:""==p)))>0 ) + { + Popup::Error( _("Selected Path is already in use!") ); + ret = false; + } + return( ret ); + } + +term LUNDetailDialog( integer pos, list<term> items ) + { + y2milestone( "LUNDetailDialog pos:%1 items:%2", pos, items ); + list<term> other = (pos>=0)?remove(items,pos):items; + y2milestone( "LUNDetailDialog other:%1", other ); + term previous= items[pos]:`Empty(); + term ret = `Empty(); + string lun_def = "99"; + if( pos<0 ) + { + integer count=0; + while( !CheckLun(count,other,true) ) + { + count = count+1; + } + lun_def = tostring(count); + } + term lun_dialog = + `VBox( + `Left( `InputField( `id( `lun ), `opt(`hstretch), "LUN", previous[1]:lun_def ) ), + `VSpacing(1), + `HBox( + `InputField( `id( `path ), `opt(`hstretch), _("Path:"), previous[3]:""), + `VBox( `Label(""), `PushButton(`id(`browse), _("Browse")))), + `InputField( `id( `name ), `opt(`hstretch), "Name (autogenerated when empty):", previous[2]:"" ), + `VSpacing(1), + `Left( `HBox( + `PushButton(`id(`ok), `opt(`default), Label::OKButton() ), + `PushButton(`id(`cancel), Label::CancelButton() ))) + ); + UI::OpenDialog(lun_dialog); + UI::ChangeWidget(`id(`lun), `ValidChars, "0123456789" ); + symbol sym = `nil; + while(sym != `ok && sym !=`cancel) + { + sym = (symbol)UI::UserInput(); + if(sym==`browse) + { + string file = UI::AskForExistingFile("/", "", _("Select file or device")); + if (file!=nil && CheckPath( file, other ) ) + UI::ChangeWidget(`path, `Value, file); + } + else if( sym==`path ) + { + CheckPath( (string)UI::QueryWidget(`path,`Value), other ); + } + if(sym == `ok) + { + integer lun=tointeger(UI::QueryWidget(`lun, `Value)); + string name = (string)UI::QueryWidget(`name,`Value); + string pth = (string)UI::QueryWidget(`path,`Value); + y2milestone( "LUNDetailDialog lun:%1 name:%2 path:%3", lun, name, pth ); + if( !CheckPath( pth, other ) || !CheckLun( lun, other, false ) || + !CheckName( name, other )) + sym = `again; + if( sym==`ok ) + { + if( size(name)==0 ) + { + list<string> used = maplist( term i, other, ``(i[2]:"")); + y2milestone( "LUNDetailDialog used:%1", used ); + name = IscsiLioData::CreateLunName( used, pth ); + } + ret = `item( `id(pos>=0?pos:size(other)), lun, name, pth ); + y2milestone( "LUNDetailDialog ret:%1", ret ); + } + } + } + UI::CloseDialog(); + y2milestone( "LUNDetailDialog ret:%1", ret ); + return ret; + } // set incoming authentication enabled/disabled status void setAuthIn(boolean status){ @@ -208,55 +220,61 @@ void initTable (string key) ``{ integer count = 0; list <term> inc_items = []; - // create items from targets - if (size(IscsiServerFunctions::getTargets())>0){ - foreach(string key, any value, IscsiServerFunctions::getTargets(), { - inc_items = add(inc_items, `item(`id(count), key)); - count = count + 1; - }); - } - // put it into table - UI::ChangeWidget(`id(`server), `Items, inc_items); -} + // create items from targets + list<list> tgt = IscsiLioData::GetTargets(); + foreach(list l, tgt, + { + inc_items = add(inc_items, `item(`id(count), l[0]:"", tostring(l[1]:0))); + count = count + 1; + }); + // put it into table + UI::ChangeWidget(`id(`server), `Items, inc_items); + } -symbol handleTable (string table, map event){ - symbol ret = nil; - if(event["EventReason"]:"" == "Activated"){ - switch((symbol)event["ID"]:nil){ - case(`add) : - // goto AddDialog() (initAddTarget) +symbol handleTable (string table, map event) + { + symbol ret = nil; + if(event["EventReason"]:"" == "Activated") + { + switch((symbol)event["ID"]:nil) + { + case(`add): + // goto AddDialog() (initAddTarget) ret = `add; break; - case(`delete) : - // add a new item - if (Popup::ContinueCancel(_("Really delete this item?"))){ - integer del=tointeger( UI::QueryWidget(`id(`server), `CurrentItem) ); - string target = ((term)UI::QueryWidget(`id(`server), `Item(del)))[1]:""; - IscsiServerFunctions::setDelChanges( target ); - IscsiServerFunctions::removeTarget( ((term)UI::QueryWidget(`id(`server), `Item(del)))[1]:"" ); - initTable(""); - } + case(`delete): + // add a new item + if (Popup::ContinueCancel(_("Really delete this item?"))) + { + integer del=tointeger( UI::QueryWidget(`id(`server), `CurrentItem) ); + string target = ((term)UI::QueryWidget(`id(`server), `Item(del)))[1]:""; + IscsiServerFunctions::setDelChanges( target ); + IscsiServerFunctions::removeTarget( ((term)UI::QueryWidget(`id(`server), `Item(del)))[1]:"" ); + initTable(""); + } break; - case(`edit) : - // edit new item - integer edit=tointeger( UI::QueryWidget(`id(`server), `CurrentItem) ); - curr_target = ((term)UI::QueryWidget(`id(`server), `Item(edit)))[1]:""; - if (IscsiServerFunctions::setModifChanges( curr_target ) == 0) y2milestone("modified %1", curr_target); - else y2error("%1 already modified", curr_target); - // goto EditDialog() (initModify) - ret = `edit; - break; - } - } - if (size((list)UI::QueryWidget(`server, `Items))==0){ - UI::ChangeWidget(`edit, `Enabled, false); - UI::ChangeWidget(`delete, `Enabled, false); - } else { - UI::ChangeWidget(`edit, `Enabled, true); - UI::ChangeWidget(`delete, `Enabled, true); - } - return ret; -} + case(`edit): + // edit new item + integer edit=tointeger( UI::QueryWidget(`id(`server), `CurrentItem) ); + term t = (term)UI::QueryWidget(`id(`server), `Item(edit)); + y2milestone("handleTable num:%1 t:%2", edit, t); + curr_target = t[1]:""; + curr_tpg = tointeger(t[2]:""); + y2milestone("handleTable tgt:%1 tpg:%2", curr_target, curr_tpg ); + if (IscsiServerFunctions::setModifChanges( curr_target ) == 0) + y2milestone("modified %1", curr_target); + else + y2error("%1 already modified", curr_target); + // goto EditDialog() (initModify) + ret = `edit; + break; + } + } + boolean empt = size((list)UI::QueryWidget(`server, `Items))==0; + UI::ChangeWidget(`edit, `Enabled, !empt); + UI::ChangeWidget(`delete, `Enabled, !empt); + return ret; + } // create items for incoming table list <term> getAuthItems(){ @@ -328,10 +346,13 @@ } // initialize discovery authentication or authentication for given target -void initGlobal (string key){ - if (size(curr_target)>0) initGlobalValues(IscsiServerFunctions::getConfig()[curr_target]:[]); - else /*if (size(IscsiServerFunctions::getConfig()["auth"]:[])>0)*/ initGlobalValues(IscsiServerFunctions::getConfig()["auth"]:[]); -} +void initGlobal (string key) + { + if (size(curr_target)>0) + initGlobalValues(IscsiServerFunctions::getConfig()[curr_target]:[]); + else + initGlobalValues(IscsiServerFunctions::getConfig()["auth"]:[]); + } // save discovery authentication or authentication for given target void storeGlobal(string option_id, map option_map){ @@ -370,7 +391,14 @@ y2milestone("init values for add_target %1", target); UI::ChangeWidget(`id(`target), `Value, target); UI::ChangeWidget(`id(`identifier), `Value, uuid); -// UI::ChangeWidget(`id(`lun), `Value, tostring(IscsiServerFunctions::getNextLun()) ); + UI::ChangeWidget(`id(`tpg), `ValidChars, String::CDigit()); + UI::ChangeWidget(`id(`tpg), `Value, "1"); + list<term> ip = (list<term>)UI::QueryWidget(`id(`ipaddr), `Items); + string s =ip[0,1]:""; + y2milestone("initAddTarget ip:%1", s ); + UI::ChangeWidget(`id(`ipaddr), `Value, s); + UI::ChangeWidget(`id(`port), `ValidChars, String::CDigit()); + UI::ChangeWidget(`id(`port), `Value, "3260"); } /* @@ -492,12 +520,14 @@ { integer count = 0; map<integer, any> temp_map = $[]; - while(count<size(inc_auth)){ - if (count<del) temp_map[count]=inc_auth[count]:nil; - else if (count==del) {} - else temp_map[count-1]=inc_auth[count]:nil; - count = count+1; - } + while(count<size(inc_auth)) + { + if (count<del) + temp_map[count]=inc_auth[count]:nil; + else if (count>del) + temp_map[count-1]=inc_auth[count]:nil; + count = count+1; + } inc_auth = temp_map; UI::ChangeWidget(`id(`incoming_table), `Items, getAuthItems()); } else y2milestone("Delete canceled"); @@ -519,102 +549,115 @@ // **************** Edit Dialog ***************************** // init values for modifying target (read it from stored map) -void initModify (string key) ``{ +void initModify (string key) + { list <term> inc_items = []; - foreach( map<string, any> row, (list<map<string, any> >) IscsiServerFunctions::editTarget( curr_target ), { - switch(row["KEY"]:""){ - case("Target") : - UI::ChangeWidget( `id(`target),`Value, (splitstring(row["VALUE"]:"", ":"))[0]:""); - UI::ChangeWidget( `id(`target),`Enabled, false); - UI::ChangeWidget( `id(`identifier), `Value, (splitstring(row["VALUE"]:"", ":"))[1]:""); - UI::ChangeWidget( `id(`identifier), `Enabled, false); + y2milestone( "initModify %1 %2", curr_target, curr_tpg ); + UI::ChangeWidget( `id(`target), `Value, (splitstring(curr_target, ":"))[0]:""); + UI::ChangeWidget( `id(`target),`Enabled, false); + UI::ChangeWidget( `id(`identifier), `Value, (splitstring(curr_target, ":"))[1]:""); + UI::ChangeWidget( `id(`identifier), `Enabled, false); + UI::ChangeWidget( `id(`tpg), `Value, tostring(curr_tpg) ); + UI::ChangeWidget( `id(`tpg), `Enabled, false); + string ipp = IscsiLioData::GetNetworkPortal( curr_target, curr_tpg )[0]:""; + y2milestone( "initModify ipp:%1", ipp ); + UI::ChangeWidget( `id(`ipaddr), `Value, (splitstring(ipp, ":"))[0]:""); + UI::ChangeWidget( `id(`ipaddr), `Enabled, true); + UI::ChangeWidget( `id(`port), `Value, (splitstring(ipp, ":"))[1]:"3260"); + UI::ChangeWidget( `id(`port), `Enabled, true); + list lun = IscsiLioData::GetLunList( curr_target, curr_tpg ); + y2milestone( "initModify lun:%1", lun ); + foreach( list l, IscsiLioData::GetLunList( curr_target, curr_tpg ), + { + inc_items = add( inc_items, `item(`id(size(inc_items)), l[0]:99, l[1]:"", l[2]:"")); + }); + UI::ChangeWidget(`id(`lun_table), `Items, inc_items); + } +symbol handleModify(string key, map event) + { + if( event["EventReason"]:"" == "Activated" ) + { + switch((symbol)event["WidgetID"]:nil) + { + case `delete: + any del = UI::QueryWidget(`id (`lun_table),`CurrentItem); + if (del != nil) + { + if(Popup::ContinueCancel(_("Really delete the selected item?"))) + { + y2milestone("Delete LUN %1 from table", del); + list items=[]; + integer count=0; + foreach(term row, (list<term>)UI::QueryWidget(`lun_table, `Items), + { + if (count!=del) + { + items=add(items, `item(`id(size(items)),row[1]:"", row[2]:"")); + } + count = count + 1; + }); + UI::ChangeWidget(`id(`lun_table), `Items, items); + } + else + y2milestone("Delete canceled"); + } break; - case("Lun") : - inc_items = add(inc_items, `item(`id(size(inc_items)), row["KEY"]:"", row["VALUE"]:"")); - // put it into table - UI::ChangeWidget(`id(`lun_table), `Items, inc_items); - + case `edit: + list<term> items = (list<term>)UI::QueryWidget(`lun_table, `Items); + integer edit_pos=tointeger(UI::QueryWidget(`lun_table, `CurrentItem)); + y2milestone( "handleModify pos:%1 items:%2", edit_pos, items ); + term ret = LUNDetailDialog( edit_pos, items ); + y2milestone( "handleModify ret:%1 em:%2 eq:%3", ret, `Empty(), ret!=`Empty() ); + if( ret!=`Empty() ) + { + items[edit_pos]=ret; + UI::ChangeWidget(`lun_table, `Items, items); + UI::ChangeWidget(`lun_table, `CurrentItem, edit_pos); + } break; - } - }); -} + case `add: + items = (list<term>)UI::QueryWidget(`lun_table, `Items); + ret = LUNDetailDialog( -1, items ); + if( ret!=`Empty() ) + { + items = (list<term>)add( items, ret ); + UI::ChangeWidget(`lun_table, `Items, items); + UI::ChangeWidget(`lun_table, `CurrentItem, size(items)-1); + } + break; + } + } + boolean enab = size((list)UI::QueryWidget(`lun_table, `Items))>0; + UI::ChangeWidget(`edit, `Enabled, enab); + UI::ChangeWidget(`delete, `Enabled, enab); + } -symbol handleModify(string key, map event){ - if ( event["EventReason"]:"" == "Activated" ){ - switch((symbol)event["WidgetID"]:nil){ - case `delete: - any del = UI::QueryWidget(`id (`lun_table),`CurrentItem); - if (del != nil){ - if (Popup::ContinueCancel(_("Really delete the selected item?"))) - { - y2milestone("Delete LUN %1 from table", del); - list items=[]; - integer count=0; - foreach(term row, (list<term>)UI::QueryWidget(`lun_table, `Items), { - if (count!=del){ - items=add(items, `item(`id(size(items)),row[1]:"", row[2]:"")); - } - count = count + 1; - }); - UI::ChangeWidget(`id(`lun_table), `Items, items); - } else y2milestone("Delete canceled"); +void storeModify(string option_id, map option_map) + { + boolean chg = false; + foreach(term row, (list<term>)UI::QueryWidget(`lun_table, `Items), + { + map lun = $[ "lun" : tointeger(row[1]:"-1"), + "nm" : row[2]:"", + "path" : row[3]:"" ]; + if(IscsiLioData::NeedUpdateLun( curr_target, curr_tpg, lun )) + { + y2milestone( "storeModify lun:%1", lun ); + chg = true; + if( !IscsiLioData::DoUpdateLun( curr_target, curr_tpg, lun )) + { + string txt = sformat( _("Problem seting lun %1 (name:%2) to path %3"), + lun["lun"]:-1, lun["nm"]:"", lun["path"]:"" ); + Popup::Error( txt ); } - break; - case `edit: - list<term> items = (list<term>)UI::QueryWidget(`lun_table, `Items); - integer edit_pos=tointeger(UI::QueryWidget(`lun_table, `CurrentItem)); - map<string, any> ret_map = LUNDetailDialog($["KEY":"Lun", "VALUE":items[edit_pos, 2]:""]); - if (ret_map!=$[]){ - items[edit_pos]=`item(`id(edit_pos), ret_map["KEY"]:"", ret_map["VALUE"]:""); - UI::ChangeWidget(`lun_table, `Items, items); - } - break; - case `add: - map<string, any> add_map = LUNDetailDialog($["KEY":"Lun", "VALUE":tostring(size((list<term>)UI::QueryWidget(`lun_table, `Items)))]); - if (add_map!=$[]){ - list items = (list)UI::QueryWidget(`lun_table, `Items); - items=add(items, `item(`id(size(items)), add_map["KEY"]:"", add_map["VALUE"]:"")); - UI::ChangeWidget(`lun_table, `Items, items); - } - break; - } - } - if (size((list)UI::QueryWidget(`lun_table, `Items))==0){ - UI::ChangeWidget(`edit, `Enabled, false); - UI::ChangeWidget(`delete, `Enabled, false); - } else { - UI::ChangeWidget(`edit, `Enabled, true); - UI::ChangeWidget(`delete, `Enabled, true); - } -} - -void storeModify(string option_id, map option_map){ - list<map<string, any> > items = []; - foreach(term row, (list<term>)UI::QueryWidget(`lun_table, `Items), { - items = add(items, $["KEY":row[1]:"", "VALUE":row[2]:""]); - }); - IscsiServerFunctions::setLUN(curr_target, items); -} - -// ************** LUN Detail Dialog **************************** -symbol handleLUN(string key, map event){ - boolean enable=false; - if ((boolean)UI::QueryWidget(`fileio, `Value)==true) enable=true; - - UI::ChangeWidget(`file_path, `Enabled, enable); - UI::ChangeWidget(`browse, `Enabled, enable); - UI::ChangeWidget(`scsi_id, `Enabled, enable); - UI::ChangeWidget(`sectors, `Enabled, !enable); - - if (event["EventReason"]:"" == "Activated" && event["WidgetID"]:nil == `browse){ - string file = UI::AskForExistingFile("/", "", _("Select file or device")); - if (file!=nil) UI::ChangeWidget(`file_path, `Value, file); - } -} - -void storeLUN(string option_id, map option_map){ - string lun=(string)UI::QueryWidget(`lun, `Value); -} + } + }); + if( chg ) + { + IscsiLioData::UpdateConfig(); + initModify(""); + } + } } Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/wizards.ycp?rev=67728&r1=67727&r2=67728&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/wizards.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/wizards.ycp Wed Mar 28 11:54:25 2012 @@ -1,25 +1,25 @@ /** - * File: include/iscsi-server/wizards.ycp - * Package: Configuration of iscsi-server + * File: include/iscsi-lio-server/wizards.ycp + * Package: Configuration of iscsi-lio-server * Summary: Wizards definitions - * Authors: Michal Zugec <mzugec@suse.cz> + * Authors: Thomas Fehr <fehr@suse.de> * * $Id$ */ { -textdomain "iscsi-server"; +textdomain "iscsi-lio-server"; import "Sequencer"; import "Wizard"; -include "iscsi-server/complex.ycp"; -include "iscsi-server/dialogs.ycp"; +include "iscsi-lio-server/complex.ycp"; +include "iscsi-lio-server/dialogs.ycp"; /** - * Main workflow of the iscsi-server configuration + * Main workflow of the iscsi-lio-server configuration * @return sequence result */ any MainSequence() { @@ -71,10 +71,10 @@ } /** - * Whole configuration of iscsi-server + * Whole configuration of iscsi-lio-server * @return sequence result */ -any IscsiServerSequence() { +any IscsiLioServerSequence() { map aliases = $[ "read" : [ ``( ReadDialog() ), true ], @@ -107,14 +107,14 @@ } /** - * Whole configuration of iscsi-server but without reading and writing. + * Whole configuration of iscsi-lio-server but without reading and writing. * For use with autoinstallation. * @return sequence result */ -any IscsiServerAutoSequence() { +any IscsiLioServerAutoSequence() { /* Initialization dialog caption */ - string caption = _("iSCSI Target Configuration"); + string caption = _("iSCSI LIO Target Configuration"); /* Initialization dialog contents */ term contents = `Label(_("Initializing...")); Added: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/yast2-iscsi-lio-server.spec.in URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/yast2-iscsi-lio-server.spec.in?rev=67728&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/yast2-iscsi-lio-server.spec.in (added) +++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/yast2-iscsi-lio-server.spec.in Wed Mar 28 11:54:25 2012 @@ -0,0 +1,32 @@ +@HEADER-COMMENT@ + + +@HEADER@ +BuildRequires: docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer popt-devel sgml-skel update-desktop-files yast2 yast2-devtools yast2-packagemanager-devel yast2-perl-bindings yast2-testsuite +Requires: yast2 + +BuildArchitectures: noarch + +Summary: Configuration of iSCSI LIO target + +%description +- + +@PREP@ + +@BUILD@ + +@INSTALL@ + +@CLEAN@ + +%files +%defattr(-,root,root) +%dir @yncludedir@/iscsi-lio-server +@yncludedir@/iscsi-lio-server/* +@clientdir@/iscsi-lio-server.ycp +@clientdir@/iscsi-lio-server_*.ycp +@moduledir@/IscsiLioServer* +@desktopdir@/iscsi-lio-server.desktop +@scrconfdir@/ietd.scr +%doc @docdir@ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org