Author: gs
Date: Tue Nov 8 14:13:52 2011
New Revision: 66754
URL: http://svn.opensuse.org/viewcvs/yast?rev=66754&view=rev
Log:
don't call 'ifconfig <if> up' (is done by fipvlan),
call fipvlan with all interfaces
Modified:
branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/FcoeClient.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/FcoeClient.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/FcoeClient.ycp?rev=66754&r1=66753&r2=66754&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/FcoeClient.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/FcoeClient.ycp Tue Nov 8 14:13:52 2011
@@ -272,45 +272,53 @@
}
//
-// Check whether a VLAN interface is configured for FCoE on the switch (for given interface)
+// Check whether VLAN interfaces are configured for FCoE on the switch
//
// Params:
// string interface network interface card, e.g. eth3
// Return:
// string Vlan interface number, e.g. 200
// Example:
-// # fipvlan eth3
+// # fipvlan eth0 eth1 eth2 eth3
//Fibre Channel Forwarders Discovered
//interface | VLAN | FCF MAC
//------------------------------------------
-//eth3 | 200 | 00:0d:ec:a2:ef:00
+//eth0 | 200 | 00:0d:ec:a2:ef:00
+//eth3 | 200 | 00:0d:ec:a2:ef:01
//
-global string GetVlanInterface( string interface )
+global map GetVlanInterfaces( list net_devices )
{
- string vlan_interface = "";
- map output = $[];
+ string vlan_cmd = "LANG=POSIX fipvlan";
+ map vlan_info = $[];
- // check whether there is a VLAN interface which is configured for FCoE
- string cmd_fcoe = sformat( "LANG=POSIX fipvlan %1", interface );
- y2milestone( "Executing command: %1", cmd_fcoe );
- output = (map)SCR::Execute( .target.bash_output, cmd_fcoe );
+ foreach ( string dev, (list<string>)net_devices, {
+ vlan_cmd = vlan_cmd + " " + dev;
+ } );
+
+ // call fipvlan command for all interfaces (saves time because is executed in parallel)
+ y2milestone( "Executing command: %1", vlan_cmd );
+ map output = (map)SCR::Execute( .target.bash_output, vlan_cmd );
y2milestone( "Output: %1", output );
-
+
list <string> lines = splitstring( output["stdout"]:"", "\n" );
- foreach( string line, (list<string>)lines, {
- // check whether there is a line for the given interface, e.g.
- // eth3 | 200 | 00:0d:ec:a2:ef:00\n
- // and extract name/number of VLAN channel.
- if ( String::StartsWith( line, interface ) )
- {
- line = deletechars( line, " \t" );
- vlan_interface = substring( line, findfirstof( line, "|" )+1,
- findlastof( line, "|" )-findfirstof( line, "|")-1 );
- y2milestone( "VLAN: %1", vlan_interface );
- }
+
+ foreach ( string dev, (list<string>)net_devices, {
+ foreach( string line, (list<string>)lines, {
+ // check whether there is a line for the given interface, e.g.
+ // eth3 | 200 | 00:0d:ec:a2:ef:00\n
+ // and extract name/number of VLAN channel.
+ if ( String::StartsWith( line, dev ) )
+ {
+ line = deletechars( line, " \t" );
+ string vlan_interface = substring( line, findfirstof( line, "|" )+1,
+ findlastof( line, "|" )-findfirstof( line, "|")-1 );
+ y2milestone( "Interface: %1 VLAN: %2", dev, vlan_interface );
+ vlan_info = add( vlan_info, dev, vlan_interface );
+ }
+ } );
} );
-
- return vlan_interface;
+ y2milestone( "VLAN info: %1", vlan_info );
+ return vlan_info;
}
//
@@ -625,46 +633,30 @@
if ( netcards == [] || netcards == nil )
return false;
+ list net_devices = [];
+
foreach ( map card, netcards, {
- // get first state map from link list in resource map
- map state_map = card["resource", "link", 0 ]:$[];
+ net_devices = add( net_devices, card["dev_name"]:"" );
+ });
- if ( state_map["state"]:false == false )
- {
- // call 'ifconfig <interface> up' here because it's not yet
- // clear who configures the interfaces (fipvlan command itself?)
- // -> see bnc #705171 (this applies also to installed system)
- string cmd_ifup = sformat( "ifconfig %1 up", card["dev_name"]:"" );
- y2milestone( "Executing command: %1", cmd_ifup );
- SCR::Execute( .target.bash_output, cmd_ifup );
-
- // ifconfig up always returns 0 -> no error message can be made
- }
- } );
- // call .probe.netcard again
- netcards = (list<map>)SCR::Read(.probe.netcard);
+ // The 'fipvlan' command which is called in GetVlanInterfaces configures the interfaces itself,
+ // therefore it's not needed any longer to call 'ifconfig <if> up' here.
+ map vlan_info = GetVlanInterfaces( net_devices );
foreach ( map card, netcards, {
- map state_map = card["resource", "link", 0]:$[];
map info_map = $[];
map