Author: gs
Date: Wed Apr 27 14:07:28 2011
New Revision: 63873
URL: http://svn.opensuse.org/viewcvs/yast?rev=63873&view=rev
Log:
get stati
Modified:
trunk/fcoe-client/src/complex.ycp
trunk/fcoe-client/src/dialogs.ycp
Modified: trunk/fcoe-client/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=63873&r1=63872&r2=63873&view=diff
==============================================================================
--- trunk/fcoe-client/src/complex.ycp (original)
+++ trunk/fcoe-client/src/complex.ycp Wed Apr 27 14:07:28 2011
@@ -88,12 +88,12 @@
y2milestone( "Init services dialog" );
}
+
//
+// Check whether a VLAN interface is configured for a given network interface
//
-//
-string GetFCoEStatus( string interface )
+string GetVlanInterface ( string interface )
{
- string status = "\"no\"";
string vlan_interface = "";
string command = sformat( "sed -n 's/\\([^ ]*\\) *.*%1/\\1/p' /proc/net/vlan/config", interface );
y2milestone( "Executing command: %1", command );
@@ -102,34 +102,51 @@
// read stdout (remove \n at the end)
vlan_interface = substring( output["stdout"]:"", 0, size(output["stdout"]:"") -1 );
+ return vlan_interface;
+}
+
+map GetFCoEStatus( string vlan_interface )
+{
+ map status_map = $[];
+
if ( vlan_interface != "")
{
string file_name = sformat( "/etc/fcoe/cfg-%1", vlan_interface );
y2milestone( "VLAN channel %1 found, reading %2", vlan_interface, file_name );
string content = (string)SCR::Read(.target.string, file_name);
- y2milestone( "Content: %1", content );
+ if ( content == "" )
+ y2warning( "Cannot read %1", file_name );
+ else
+ y2milestone( "Content: %1", content );
+
list <string> lines = splitstring( content, "\n" );
foreach( string line, (list<string>)lines, {
if ( regexpmatch( line, "^FCOE_ENABLE" ) )
{
- status = substring( line, 12 );
- y2milestone( "FCOE_ENABLE: %1", status );
+ status_map = add( status_map, "FCOE_ENABLE", substring( line, 12 ) );
+ y2milestone( "FCOE_ENABLE: %1", status_map["FCOE_ENABLE"]:"" );
+ }
+ if ( regexpmatch( line, "^DCB_REQUIRED" ) )
+ {
+ status_map = add( status_map, "DCB_REQUIRED", substring( line, 13 ) );
+ y2milestone( "DCB_REQUIRED: %1", status_map["DCB_REQUIRED"]:"" );
}
});
}
else
{
- y2milestone( "Nothing configured for %1", interface );
+ y2error( "Interface not valid" );
}
- return status;
+ return status_map;
}
void InitInterfacesDialog (string id) {
y2milestone( "Init interfaces dialog" );
-
+ string vlan_interface = "";
+
list <map> netcards = (list<map>)SCR::Read(.probe.netcard);
y2milestone( "Detected netcards: %1", netcards );
@@ -137,9 +154,16 @@
integer row = 0;
foreach ( map card, netcards, {
+ map status_map = $[];
+ vlan_interface = GetVlanInterface( card["dev_name"]:"" );
+ if ( vlan_interface != "" )
+ status_map = GetFCoEStatus( vlan_interface );
+ else
+ vlan_interface = "not configured";
+
table_items = add( table_items,
- `item(`id(row), card["dev_name"]:"", card["device"]:"",
- GetFCoEStatus(card["dev_name"]:"") )
+ `item(`id(row), card["dev_name"]:"", card["device"]:"", vlan_interface,
+ status_map["FCOE_ENABLE"]:"", status_map["DCB_REQUIRED"]:"" )
);
row = row + 1;
});
Modified: trunk/fcoe-client/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/dialogs.ycp?rev=63873&r1=63872&r2=63873&view=diff
==============================================================================
--- trunk/fcoe-client/src/dialogs.ycp (original)
+++ trunk/fcoe-client/src/dialogs.ycp Wed Apr 27 14:07:28 2011
@@ -82,10 +82,13 @@
return `MarginBox( mbox_x, mbox_y,
`VBox(
`Table(`id(`interfaces), `opt(`notify, `immediate ),
- `header(_("Device Name"), _("Model"), _("FCoE Enabled"), _("DCB Required")),
+ `header(_("Device Name"), _("Model"), _("VLAN Interface"),
+ _("FCoE Enabled"), _("DCB Required")),
[]
),
- `Left( `PushButton(`id(`edit), _("Change &Settings")) )
+ `Left(`HBox( `PushButton(`id(`edit), _("Change &Settings") ),
+ `PushButton(`id(`config), _("Configure &VLAN")) )
+ )
)
);
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org