[yast-commit] r63905 - in /trunk/fcoe-client/src: FcoeClient.ycp complex.ycp
Author: gs Date: Thu May 5 13:24:15 2011 New Revision: 63905 URL: http://svn.opensuse.org/viewcvs/yast?rev=63905&view=rev Log: bugfixes get FCoE VLAN interface 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=63905&r1=63904&r2=63905&view=diff ============================================================================== --- trunk/fcoe-client/src/FcoeClient.ycp (original) +++ trunk/fcoe-client/src/FcoeClient.ycp Thu May 5 13:24:15 2011 @@ -180,7 +180,7 @@ //------------------------------------------ //eth3 | 200 | 00:0d:ec:a2:ef:00 // -string GetVlanInterface( string interface ) +global string GetVlanInterface( string interface ) { string vlan_interface = ""; @@ -221,7 +221,7 @@ //Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD //eth3.200 | 200 | eth3 -string GetFcoeVlanInterface ( string interface, string vlan_interface ) +global string GetFcoeVlanInterface ( string interface, string vlan_interface ) { string vlan_device_name = ""; @@ -230,25 +230,35 @@ y2milestone( "Executing command: %1", command ); map output = (map)SCR::Execute( .target.bash_output, command ); - // read stdout (remove \n at the end) - vlan_interface = substring( output["stdout"]:"", 0, size(output["stdout"]:"") -1 ); - + y2milestone( "Output: %1", output ); + // read stdout (remove \n and white spaces) + vlan_device_name = deletechars( output["stdout"]:"", " \n\t" ); + + y2milestone( "Returning: %1", vlan_device_name ); return vlan_device_name; } // // Get status of FCoE and DCB from /etc/fcoe/cfg-eth<vlan_device_name> // -map <string, string> GetFCoEStatus( string vlan_device_name ) +global map <string, string> GetFCoEStatus( string vlan_device_name ) { map <string, string> status_map = $[]; + string content = ""; if ( vlan_device_name != "") { string file_name = sformat( "/etc/fcoe/cfg-%1", vlan_device_name ); y2milestone( "VLAN channel %1 found, reading %2", vlan_device_name, file_name ); - string content = (string)SCR::Read(.target.string, file_name); + content = (string)SCR::Read(.target.string, file_name); + if ( content == "" || content == nil ) + { + y2warning( "Cannot read %1", file_name ); + file_name = substring( file_name, 0, size(file_name)-5 ); // remove '-fcoe'; + content = (string)SCR::Read(.target.string, file_name); + } + if ( content == "" || content == nil ) { y2warning( "Cannot read %1", file_name ); @@ -258,6 +268,7 @@ { y2milestone( "Content: %1", content ); } + list <string> lines = splitstring( content, "\n" ); foreach( string line, (list<string>)lines, { @@ -387,6 +398,11 @@ return network_interfaces; } +global void SetNetworkCardsValue( integer row, list card ) +{ + network_interfaces[row] = card; +} + // // Read /etc/fcoe/config // Modified: trunk/fcoe-client/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=63905&r1=63904&r2=63905&view=diff ============================================================================== --- trunk/fcoe-client/src/complex.ycp (original) +++ trunk/fcoe-client/src/complex.ycp Thu May 5 13:24:15 2011 @@ -218,13 +218,54 @@ { list card = (list)GetCurrentNetcard(); string dev_name = card[0]:""; - boolean ret = Popup::YesNoHeadline( _("Creating VLAN Interface"), - sformat( _("Do you really want to create - a VLAN Interface on %1?"), dev_name ) ); + boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"), + sformat( _("Do you really want to create a network +interface on %1 for discovered FCoE VLAN interface +and start the FCoE initiator?"), dev_name ) ); if ( ret == true ) { + string vlan_interface = ""; + string fcoe_vlan_interface = ""; + map status_map = $[]; + // create and start FCoE with 'fipvlan -c -s eth3' + // revert this (in case of 'Abort') with 'vconfig rem eth3.200' string command = sformat( "fipvlan -c -s %1", dev_name ); y2milestone( "Executing command: %1", command ); + map output = (map)SCR::Execute( .target.bash_output, command ); + y2milestone( "Output: %1", output ); + + if ( output["exit"]:255 == 0 ) + { + // Get new status and exchange list (table) entry + vlan_interface = FcoeClient::GetVlanInterface( card[0]:"" ); + if ( vlan_interface == "" ) + { + fcoe_vlan_interface = FcoeClient::NOT_AVAILABLE; + } + else + { + fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card[0]:"", vlan_interface ); + + if ( fcoe_vlan_interface != "" ) + status_map = FcoeClient::GetFCoEStatus( fcoe_vlan_interface ); + else + fcoe_vlan_interface = FcoeClient::NOT_CONFIGURED; + } + y2milestone( "FCoE VLAN interface: %1", fcoe_vlan_interface ); + // set new value in global map network_interfaces + card[2] = fcoe_vlan_interface; + FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card ); + y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() ); + y2milestone( "Replace value 2 in row %1 by %2", FcoeClient::current_card, fcoe_vlan_interface ); + // replace value in table + UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 2), fcoe_vlan_interface ); + AdjustButtons(); + + } + else + { + Popup::Error( sformat( _("Cannot create and start FCoE on %1"), dev_name ) ); + } } else { -- 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