[yast-commit] r63894 - in /trunk/fcoe-client/src: FcoeClient.ycp complex.ycp dialogs.ycp
Author: gs Date: Tue May 3 15:34:23 2011 New Revision: 63894 URL: http://svn.opensuse.org/viewcvs/yast?rev=63894&view=rev Log: add/check DCB capable Modified: trunk/fcoe-client/src/FcoeClient.ycp trunk/fcoe-client/src/complex.ycp trunk/fcoe-client/src/dialogs.ycp Modified: trunk/fcoe-client/src/FcoeClient.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/FcoeClient.ycp?rev=63894&r1=63893&r2=63894&view=diff ============================================================================== --- trunk/fcoe-client/src/FcoeClient.ycp (original) +++ trunk/fcoe-client/src/FcoeClient.ycp Tue May 3 15:34:23 2011 @@ -221,11 +221,40 @@ } // +// Check whether the network interface (netcard, e.g. eth0 is DCB capable) +// +string DCBCapable( string netcard ) +{ + string command = sformat( "LANG=POSIX dcbtool gc %1 dcb", netcard ); + y2milestone( "Executing command: %1", command ); + + // TODO: lldpad must be started to be able to use dcbtool + // -> started in CheckServices() -> Read() + // ACHTUNG: Reihenfolge !!! + map output = (map)SCR::Execute( .target.bash_output, command ); + y2milestone( "Output: %1", output); + + if ( output["exit"]:255 == 0 ) + { + list <string> lines = splitstring( output["stdout"]:"", "\n" ); + } + else + { + y2error( "Error: %1", output["stderr"]:"" ); + Popup::Error ( output["stderr"]:"" ); + return "no"; + } + + return "no"; +} + +// // Detect network interface cards (hardware probe) and get status // void DetectNetworkCards() { string vlan_interface = ""; + string dcb_capable = ""; list <map> netcards = (list<map>)SCR::Read(.probe.netcard); y2milestone( "Detected netcards: %1", netcards ); @@ -241,9 +270,12 @@ else vlan_interface = NOT_CONFIGURED; + dcb_capable = DCBCapable( card["dev_name"]:"" ); + info_list = add( info_list, card["dev_name"]:""); info_list = add( info_list, card["device"]:""); info_list = add( info_list, vlan_interface ); + info_list = add( info_list, dcb_capable ); info_list = add( info_list, status_map["FCOE_ENABLE"]:""); info_list = add( info_list, status_map["DCB_REQUIRED"]:""); Modified: trunk/fcoe-client/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=63894&r1=63893&r2=63894&view=diff ============================================================================== --- trunk/fcoe-client/src/complex.ycp (original) +++ trunk/fcoe-client/src/complex.ycp Tue May 3 15:34:23 2011 @@ -89,26 +89,37 @@ } // +// Get current network interface (netcard) // -// -void AdjustButtons() +list GetCurrentNetcard() { + list card = []; + map <integer, list> netcards = FcoeClient::GetNetworkCards(); integer row = (integer)UI::QueryWidget( `id(`interfaces), `CurrentItem ); - list card = netcards[row]:[]; + card = netcards[row]:[]; + y2milestone( "Current row: %1 card: %2", row, card ); - y2milestone( "row: %1 card: %2", row, card ); + return card; +} + +// +// Adjust buttons, means set 'Change Settings' and 'Create VLAN' sensitive or insensitive +// +void AdjustButtons() +{ + list card = GetCurrentNetcard(); // check VLAN status if ( card[2]:"" == FcoeClient::NOT_CONFIGURED ) { UI::ChangeWidget( `id(`edit), `Enabled, false ); - UI::ChangeWidget( `id(`config), `Enabled, true ); + UI::ChangeWidget( `id(`create), `Enabled, true ); } else { UI::ChangeWidget( `id(`edit), `Enabled, true ); - UI::ChangeWidget( `id(`config), `Enabled, false ); + UI::ChangeWidget( `id(`create), `Enabled, false ); } } @@ -125,7 +136,7 @@ foreach ( integer row, list card, netcards, { table_items = add( table_items, `item(`id(row), card[0]:"", card[1]:"", card[2]:"", - card[3]:"", card[4]:"" ) + card[3]:"", card[4]:"", card[5]:"" ) ); }); @@ -182,13 +193,30 @@ if ( action == `edit ) { - y2milestone( "Action: %1, returning `edit", action); + y2milestone( "Action: %1, returning %1", action); return `edit; } else if ( action == `interfaces ) { AdjustButtons(); } + else if ( action == `create ) + { + 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 ) ); + if ( ret == true ) + { + string command = sformat( "fipvlan -c -s %1", dev_name ); + y2milestone( "Executing command: %1", command ); + } + else + { + y2milestone( "Creating VLAN interface canceled" ); + } + } return nil; } Modified: trunk/fcoe-client/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/dialogs.ycp?rev=63894&r1=63893&r2=63894&view=diff ============================================================================== --- trunk/fcoe-client/src/dialogs.ycp (original) +++ trunk/fcoe-client/src/dialogs.ycp Tue May 3 15:34:23 2011 @@ -82,12 +82,12 @@ return `MarginBox( mbox_x, mbox_y, `VBox( `Table(`id(`interfaces), `opt(`notify, `immediate ), - `header(_("Device Name"), _("Model"), _("VLAN Interface"), + `header(_("Device Name"), _("Model"), _("VLAN Interface"), _("DCB capable"), _("FCoE Enabled"), _("DCB Required")), [] ), `Left(`HBox( `PushButton(`id(`edit), _("Change &Settings") ), - `PushButton(`id(`config), _("Create &VLAN Interface")) ) + `PushButton(`id(`create), _("Create &VLAN Interface")) ) ) ) ); -- 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