[yast-commit] r64032 - in /trunk/fcoe-client/src: FcoeClient.ycp complex.ycp
![](https://seccdn.libravatar.org/avatar/1221572c74a1df78a3aa2625b979eb21.jpg?s=120&d=mm&r=g)
Author: gs Date: Wed May 18 13:17:55 2011 New Revision: 64032 URL: http://svn.opensuse.org/viewcvs/yast?rev=64032&view=rev Log: restart fcoe in Write() Modified: trunk/fcoe-client/src/FcoeClient.ycp trunk/fcoe-client/src/complex.ycp Modified: trunk/fcoe-client/src/FcoeClient.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/FcoeClient.ycp?rev=64032&r1=64031&r2=64032&view=diff ============================================================================== --- trunk/fcoe-client/src/FcoeClient.ycp (original) +++ trunk/fcoe-client/src/FcoeClient.ycp Wed May 18 13:17:55 2011 @@ -428,6 +428,7 @@ { // TODO - check whether loading any modules in Stage::initial() is required // (like in IsciClientLib.ycp, line 469 ) + // probably NOT -> see /etc/init.d/fcoe, line 85 (modprobe fcoe > /dev/null 2>&1) boolean ret = true; if ( Service::Status( "fcoe" ) != 0 ) @@ -478,7 +479,7 @@ // // Detect network interface cards (hardware probe) and get status // -void DetectNetworkCards() +boolean DetectNetworkCards() { string vlan_interface = ""; string fcoe_vlan_interface = ""; @@ -486,6 +487,9 @@ list <map> netcards = (list<map>)SCR::Read(.probe.netcard); y2milestone( "Detected netcards: %1", netcards ); + + if ( netcards == [] || netcards == nil ) + return false; foreach ( map card, netcards, { map info_map = $[]; @@ -512,7 +516,6 @@ fcoe_vlan_interface = NOT_CONFIGURED; } } - dcb_capable = DCBCapable( card["dev_name"]:"" ); info_map = add( info_map, "dev_name", card["dev_name"]:""); // network card, e.g. eth3 @@ -526,10 +529,12 @@ info_map = add( info_map, "cfg_file", status_map["Filename"]:"" ); // cfg file name, e.g. /etc/fcoe/cfg-eth3.200 network_interfaces = add( network_interfaces, info_map ); - network_interfaces = sort( map a, map b, network_interfaces, { + } ); + // sort the list of interfaces (eth0, eth1, eth2...) + network_interfaces = sort( map a, map b, network_interfaces, { return ( a["dev_name"]:"" < b["dev_name"]:"" ); } ); - } ); + return true; } // @@ -554,23 +559,21 @@ // // Read /etc/fcoe/config // -void ReadFcoeConfig() +boolean ReadFcoeConfig() { list <string> options = (list<string>) SCR::Dir(.fcoe); y2milestone( "List of options: %1", options ); - // TODO take values from list - if ( options != [] ) - { - string debug_val = (string)SCR::Read(add(.fcoe, "DEBUG")); - fcoe_general_config = add( fcoe_general_config, "DEBUG", debug_val ); + + if ( options == [] || options == nil ) + return false; + + string debug_val = (string)SCR::Read(add(.fcoe, "DEBUG")); + fcoe_general_config = add( fcoe_general_config, "DEBUG", debug_val ); - string syslog_val = (string)SCR::Read(add(.fcoe, "USE_SYSLOG")); - fcoe_general_config = add( fcoe_general_config, "USE_SYSLOG", syslog_val ); - } - else - { - y2error( "Cannot read /etc/fcoe/config" ); - } + string syslog_val = (string)SCR::Read(add(.fcoe, "USE_SYSLOG")); + fcoe_general_config = add( fcoe_general_config, "USE_SYSLOG", syslog_val ); + + return true; } // @@ -669,6 +672,12 @@ return success; } +boolean RestartServiceFcoe() +{ + y2milestone( "Restarting fcoe"); + return Service::Restart("fcoe"); +} + /** * Read all fcoe-client settings * @return true on success @@ -733,17 +742,17 @@ boolean start_status = ServiceStatus(); /* Error message */ - if(!start_status) Report::Error(_("Starting of services failed")); + if(!start_status) Report::Error(_("Starting of services failed.")); sleep(sl); if(Abort()) return false; Progress::NextStage(); - // detect netcards - TODO return value - DetectNetworkCards(); + // detect netcards + boolean success = DetectNetworkCards(); /* Error message */ - if(false) Report::Warning(_("Cannot detect devices.")); + if( !success ) Report::Warning(_("Cannot detect devices.")); sleep(sl); // read general FCoE settings @@ -751,10 +760,10 @@ Progress::NextStage(); // check daemon fcoemon and lldpad - ReadFcoeConfig(); + success = ReadFcoeConfig(); /* Error message */ - if(false) Report::Error(_("Checking for services failed")); + if( !success ) Report::Error(_("Cannot read /etc/fcoe/config.")); sleep(sl); Progress::Finish(); @@ -777,7 +786,7 @@ y2milestone( "Saving fcoe-client Configuration" ); // Set the number of stages - integer steps = 2; + integer steps = 3; integer sl = 500; @@ -785,12 +794,16 @@ Progress::New(caption, " ", steps, [ /* Progress stage 1/2 */ _("Write the settings"), - /* Progress stage 2/2 */ + /* Progress stage 2/3 */ + _("Restart FCoE service"), + /* Progress stage 3/3 */ _("Adjust start of services") ], [ /* Progress step 1/2 */ _("Writing the settings..."), - /* Progress step 2/2 */ + /* Progress step 2/3 */ + _("Restarting FCoE service..."), + /* Progress sstep 3/3 */ _("Adjusting start of services..."), /* Progress finished */ _("Finished") @@ -812,14 +825,25 @@ success = WriteCfgFiles(); if( !success ) Report::Error (_("Cannot write settings for FCoE interfaces. For details see /var/log/YaST2/y2log") ); + + // restart fcoe to enable changes + if(Abort()) return false; + Progress::NextStage(); + + success = RestartServiceFcoe(); + /* Error message */ + if( !success ) Report::Error (_("/etc/init.d/fcoe restart failed.")); + sleep(sl); - // run SuSEconfig + // adjust service start of lldpad and fcoe if(Abort()) return false; Progress::NextStage (); + // adjust start status of services lldpad and fcoe AdjustStartStatus(); /* Error message */ + /* TODO - SuSEConfig required ???? */ if(false) Report::Error (Message::SuSEConfigFailed()); sleep(sl); Modified: trunk/fcoe-client/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=64032&r1=64031&r2=64032&view=diff ============================================================================== --- trunk/fcoe-client/src/complex.ycp (original) +++ trunk/fcoe-client/src/complex.ycp Wed May 18 13:17:55 2011 @@ -273,6 +273,7 @@ card["fcoe_enable"] = status_map["FCOE_ENABLE"]:""; card["dcb_required"] = status_map["DCB_REQUIRED"]:""; card["cfg_file"] = status_map["Filename"]:""; + card["modified"] = "yes"; FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card ); y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn2.opensuse.org