Author: gs Date: Wed May 4 09:44:47 2011 New Revision: 63895 URL: http://svn.opensuse.org/viewcvs/yast?rev=63895&view=rev Log: get DCB Status Modified: trunk/fcoe-client/src/FcoeClient.ycp Modified: trunk/fcoe-client/src/FcoeClient.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/FcoeClient.ycp?rev=63895&r1=63894&r2=63895&view=diff ============================================================================== --- trunk/fcoe-client/src/FcoeClient.ycp (original) +++ trunk/fcoe-client/src/FcoeClient.ycp Wed May 4 09:44:47 2011 @@ -225,27 +225,40 @@ // string DCBCapable( string netcard ) { + string ret = "no"; + 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 !!! + // ACHTUNG: Reihenfolge !!!# map output = (map)SCR::Execute( .target.bash_output, command ); y2milestone( "Output: %1", output); - + string status = ""; + if ( output["exit"]:255 == 0 ) { - list <string> lines = splitstring( output["stdout"]:"", "\n" ); + list <string> lines = splitstring( output["stdout"]:"", "\n" ); + foreach( string line, (list<string>)lines, { + if ( regexpmatch( line, "^Status" ) ) + { + // Status: Failed interface not DCB capable + // Status: Successful + status = substring( line, 16 ); + } } ); + if ( status == "Successful" ) + { + ret = "yes"; + } } else { y2error( "Error: %1", output["stderr"]:"" ); Popup::Error ( output["stderr"]:"" ); - return "no"; } - return "no"; + return ret; } // @@ -305,7 +318,8 @@ * Read all fcoe-client settings * @return true on success */ -global boolean Read() { +global boolean Read() +{ /* FcoeClient read dialog caption */ string caption = _("Initializing fcoe-client Configuration"); @@ -318,24 +332,24 @@ // We do not set help text here, because it was set outside Progress::New( caption, " ", steps, [ - /* Progress stage 1/3 */ - _("Check installed packages"), - /* Progress stage 2/3 */ - _("Detect network cards"), - /* Progress stage 3/3 */ - _("Check services") - ], [ - /* Progress step 1/3 */ - _("Checking for installed packages..."), - /* Progress step 2/3 */ - _("Detecting network cards..."), - /* Progress step 3/3 */ - _("Checking for services..."), - /* Progress finished */ - _("Finished") - ], - "" - ); + /* Progress stage 1/3 */ + _("Check installed packages"), + /* Progress stage 2/3 */ + _("Detect network cards"), + /* Progress stage 3/3 */ + _("Check services") + ], [ + /* Progress step 1/3 */ + _("Checking for installed packages..."), + /* Progress step 2/3 */ + _("Detecting network cards..."), + /* Progress step 3/3 */ + _("Checking for services..."), + /* Progress finished */ + _("Finished") + ], + "" + ); // read database if(Abort()) return false; @@ -376,7 +390,8 @@ * Write all fcoe-client settings * @return true on success */ -global boolean Write() { +global boolean Write() +{ /* FcoeClient read dialog caption */ string caption = _("Saving fcoe-client Configuration"); @@ -389,20 +404,20 @@ // We do not set help text here, because it was set outside Progress::New(caption, " ", steps, [ - /* Progress stage 1/2 */ - _("Write the settings"), - /* Progress stage 2/2 */ - _("Run SuSEconfig") - ], [ - /* Progress step 1/2 */ - _("Writing the settings..."), - /* Progress step 2/2 */ - _("Running SuSEconfig..."), - /* Progress finished */ - _("Finished") - ], - "" - ); + /* Progress stage 1/2 */ + _("Write the settings"), + /* Progress stage 2/2 */ + _("Run SuSEconfig") + ], [ + /* Progress step 1/2 */ + _("Writing the settings..."), + /* Progress step 2/2 */ + _("Running SuSEconfig..."), + /* Progress finished */ + _("Finished") + ], + "" + ); boolean is_running = Progress::IsRunning(); y2milestone( "**** Progress still running: %1", is_running ); @@ -433,7 +448,8 @@ * @param settings The YCP structure to be imported. * @return boolean True on success */ -global boolean Import (map settings) { +global boolean Import (map settings) +{ // TODO FIXME: your code here (fill the above mentioned variables)... return true; } @@ -443,7 +459,8 @@ * (For use by autoinstallation.) * @return map Dumped settings (later acceptable by Import ()) */ -global map Export () { +global map Export () +{ // TODO FIXME: your code here (return the above mentioned variables)... return $[]; } @@ -452,7 +469,8 @@ * Create a textual summary and a list of unconfigured cards * @return summary of the current configuration */ -global list Summary() { +global list Summary() +{ // TODO FIXME: your code here... /* Configuration summary text for autoyast */ return [ _("Configuration summary..."), [] ]; @@ -473,7 +491,8 @@ * installed. * @return map with 2 lists. */ -global map AutoPackages() { +global map AutoPackages() +{ // TODO FIXME: your code here... return $[ "install":[], "remove":[] ]; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org