[yast-commit] r64113 - in /trunk/fcoe-client/src: FcoeClient.ycp complex.ycp

Author: gs Date: Thu May 26 12:59:39 2011 New Revision: 64113 URL: http://svn.opensuse.org/viewcvs/yast?rev=64113&view=rev Log: installed system: start FcoE only 'fipvlan -s <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?re... ============================================================================== --- trunk/fcoe-client/src/FcoeClient.ycp (original) +++ trunk/fcoe-client/src/FcoeClient.ycp Thu May 26 12:59:39 2011 @@ -272,8 +272,11 @@ 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 ); + + if ( vlan_device_name != "" ) + { + y2milestone( "Returning: %1", vlan_device_name ); + } return vlan_device_name; } Modified: trunk/fcoe-client/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=6... ============================================================================== --- trunk/fcoe-client/src/complex.ycp (original) +++ trunk/fcoe-client/src/complex.ycp Thu May 26 12:59:39 2011 @@ -37,6 +37,7 @@ import "Confirm"; import "FcoeClient"; import "Service"; +import "Stage"; include "fcoe-client/helps.ycp"; @@ -232,93 +233,142 @@ symbol HandleInterfacesDialog( string id, map event ) { - any action = event["ID"]:nil; - - y2milestone( "Event: %1", event ); + any action = event["ID"]:nil; + + y2milestone( "Event: %1", event ); - if ( action == `edit ) - { - y2milestone( "Action: %1, returning %1", action); - return `edit; - } - else if ( action == `interfaces ) - { - FcoeClient::current_card = (integer)UI::QueryWidget( `id(`interfaces), `CurrentItem ); - AdjustButtons(); - } - else if ( action == `create ) - { - map card = FcoeClient::GetCurrentNetworkCard(); - string dev_name = card["dev_name"]:""; - boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"), - sformat( _("Do you really want to create a FCoE network + if ( action == `edit ) + { + y2milestone( "Action: %1, returning %1", action); + return `edit; + } + else if ( action == `interfaces ) + { + FcoeClient::current_card = (integer)UI::QueryWidget( `id(`interfaces), `CurrentItem ); + AdjustButtons(); + } + else if ( action == `create ) + { + map card = FcoeClient::GetCurrentNetworkCard(); + string dev_name = card["dev_name"]:""; + string command = ""; + map output = $[]; + string vlan_interface = ""; + string fcoe_vlan_interface = ""; + map status_map = $[]; + + if ( Stage::initial() ) // first stage - create and start FCoE VLAN interface + { + boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"), + sformat( _("Do you really want to create a FCoE network interface for discovered FCoE VLAN interface on %1 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["dev_name"]:"" ); - if ( vlan_interface == "" ) - { - fcoe_vlan_interface = FcoeClient::NOT_AVAILABLE; - } - else - { - fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"", 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["fcoe_vlan"] = fcoe_vlan_interface; - card["fcoe_enable"] = status_map["FCOE_ENABLE"]:""; - card["dcb_required"] = status_map["DCB_REQUIRED"]:""; - card["cfg_file"] = status_map["Filename"]:""; - card["modified"] = "yes"; - FcoeClient::SetModified( true ); - - FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card ); - y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() ); + if ( ret == true ) + { + // create and start FCoE e.g. with 'fipvlan -c -s eth3' + // revert this (in case of 'Abort') with 'vconfig rem eth3.200' + command = sformat( "fipvlan -c -s %1", dev_name ); + y2milestone( "Executing command: %1", command ); + output = (map)SCR::Execute( .target.bash_output, command ); + y2milestone( "Output: %1", output ); + + if ( output["exit"]:255 != 0 ) + { + Popup::Error( sformat( _("Cannot create and start FCoE on %1"), dev_name ) ); + return nil; + } + } + else + { + y2milestone( "Creating FCoE VLAN interface canceled" ); + return nil; + } + } + else // installed system - if VLAN already exists only start FCoE + { + boolean ret = Popup::YesNoHeadline( _("Starting FCoE on detected VLAN device"), + sformat( _("Do you really want to start FCoE initiator +on discovered FCoE VLAN interface on %1?"), dev_name ) ); + if ( ret == true ) + { + // call 'ifup' for vlan interface - creates /proc/net/vlan/<vlan-interface> + // if /etc/sysconfig/network/ifcfg-<vlan-interface> already exists + command = sformat( "ifup %1\.%2", dev_name, card["vlan_interface"]:"" ); + y2milestone( "Executing command: %1", command ); + output = (map)SCR::Execute( .target.bash_output, command ); + y2milestone( "Output: %1", output ); + + if ( output["exit"]:255 == 0 ) + { + // start FCoE + command = sformat( "fipvlan -s %1", dev_name ); + } + else + { + // create and start FCoE + command = sformat( "fipvlan -c -s %1", dev_name ); + } + + y2milestone( "Executing command: %1", command ); + output = (map)SCR::Execute( .target.bash_output, command ); + y2milestone( "Output: %1", output ); + if ( output["exit"]:255 != 0 ) + { + Popup::Error( sformat( _("Command \"%1\" on %2 failed."), command, dev_name ) ); + return nil; + } + } + else + { + y2milestone( "Starting FCoE canceled" ); + return nil; + } + } - // replace value in table - UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 2), fcoe_vlan_interface ); - UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 4), status_map["FCOE_ENABLE"]:"" ); - UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 5), status_map["DCB_REQUIRED"]:"" ); - AdjustButtons(); - if ( fcoe_vlan_interface != "" ) - { - // store command to be able to redo the creation of FCoE VLAN interface - // in case of abort - FcoeClient::AddRedoCommand( sformat("vconfig rem %1", fcoe_vlan_interface ) ); - } - } - else - { - Popup::Error( sformat( _("Cannot create and start FCoE on %1"), dev_name ) ); - } - } - else - { - y2milestone( "Creating VLAN interface canceled" ); - } - } + // Get new status and exchange list (table) entry + vlan_interface = FcoeClient::GetVlanInterface( card["dev_name"]:"" ); + if ( vlan_interface == "" ) + { + fcoe_vlan_interface = FcoeClient::NOT_AVAILABLE; + } + else + { + fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"", vlan_interface ); - return nil; + if ( fcoe_vlan_interface != "" ) + { + y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface ); + status_map = FcoeClient::GetFCoEStatus( fcoe_vlan_interface ); + + // store command to be able to redo the creation of FCoE VLAN interface + // in case of abort - TODO: is this also OK if only 'fipvlan -s <interface>' is called? + FcoeClient::AddRedoCommand( sformat("vconfig rem %1", fcoe_vlan_interface ) ); + card["modified"] = "yes"; + FcoeClient::SetModified( true ); + } + else + { + fcoe_vlan_interface = FcoeClient::NOT_CONFIGURED; + } + } + + // set new values in global map network_interfaces + card["fcoe_vlan"] = fcoe_vlan_interface; + card["fcoe_enable"] = status_map["FCOE_ENABLE"]:""; + card["dcb_required"] = status_map["DCB_REQUIRED"]:""; + card["cfg_file"] = status_map["Filename"]:""; + + FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card ); + y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() ); + + // replace values in table + UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 2), fcoe_vlan_interface ); + UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 4), status_map["FCOE_ENABLE"]:"" ); + UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 5), status_map["DCB_REQUIRED"]:"" ); + AdjustButtons(); + } + + return nil; } symbol HandleConfigurationDialog( string id, map event ) -- 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