Author: gs
Date: Tue Oct 11 13:09:59 2011
New Revision: 66380
URL: http://svn.opensuse.org/viewcvs/yast?rev=66380&view=rev
Log:
use ini agent, write sysconfig for underlying
interface, destroy FCoE before removing
Added:
trunk/fcoe-client/agents/fcoe_cfg-ethx.scr
Modified:
trunk/fcoe-client/VERSION
trunk/fcoe-client/agents/fcoe_config.scr
trunk/fcoe-client/package/yast2-fcoe-client.changes
trunk/fcoe-client/src/FcoeClient.ycp
trunk/fcoe-client/src/complex.ycp
trunk/fcoe-client/src/dialogs.ycp
trunk/fcoe-client/src/fcoe-client_auto.ycp
trunk/fcoe-client/src/fcoe-client_finish.ycp
trunk/fcoe-client/src/inst_fcoe-client.ycp
trunk/fcoe-client/src/wizards.ycp
Modified: trunk/fcoe-client/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/VERSION?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/VERSION (original)
+++ trunk/fcoe-client/VERSION Tue Oct 11 13:09:59 2011
@@ -1 +1 @@
-2.21.8
+2.21.9
Added: trunk/fcoe-client/agents/fcoe_cfg-ethx.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/agents/fcoe_cfg-ethx.scr?rev=66380&view=auto
==============================================================================
--- trunk/fcoe-client/agents/fcoe_cfg-ethx.scr (added)
+++ trunk/fcoe-client/agents/fcoe_cfg-ethx.scr Tue Oct 11 13:09:59 2011
@@ -0,0 +1,39 @@
+/**
+ * File: fcoe_cfg-ethx.scr
+ * Summary: Agent for /etc/fcoe/cfg-*
+ * Access: read / write
+ * See: sysconfig.rpm
+ *
+ * General syntax:
+ * # comment0
+ * VAR1=val1 # comment1
+ * VAR2="val 2 #blah" # comment2
+ * VAR3='val3 x #blah2' # comment3
+ *
+ *
+ * <p>Reads/writes <tt>/etc/fcoe/cfg-*</tt>.
+ */
+.fcoe.cfg-ethx
+
+`ag_ini(
+ `IniAgent( [ "/etc/fcoe/cfg-*" ],
+ $[
+ /* values at the top level, allow comments after value */
+ "options" : [ "global_values", "comments_last" ],
+ /* empty lines, comments after value and whole-line comments */
+ "comments" : [ "^[ \t]*$", "[ \t]*#.*$", "^[ \t]*#.*$" ],
+ /* matching rules */
+ "params" : [
+ /* VAR1="val1 'bal x" */
+ $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)=\"([^\"`\\$]*)\"", "%s='%s'" ] ],
+ /* VAR1='val1 xxx" xx' */
+ $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)='([^']*)'", "%s='%s'" ] ],
+ /* VAR1=val1 */
+ $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)=([^ \t\"$`'\\#]*)", "%s='%s'" ] ],
+ ],
+ /* matching rules */
+ "rewrite" : [
+ [ "/etc/fcoe/cfg-(.*)", "/etc/fcoe/cfg-%s" ],
+ ],
+ ]
+))
Modified: trunk/fcoe-client/agents/fcoe_config.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/agents/fcoe_config.scr?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/agents/fcoe_config.scr (original)
+++ trunk/fcoe-client/agents/fcoe_config.scr Tue Oct 11 13:09:59 2011
@@ -3,26 +3,23 @@
* fcoe_config.scr
* Summary:
* SCR Agent for reading/writing /etc/fcoe/config
- * using the ini-agent
+ * using the sysconfig agent
* Access:
* read/write
* Authors:
* Gabriele Mohr
- * See:
- * yast2-agent-ini/ini.html
- * libscr
* Example:
* Read(.fcoe.config.USE_SYSLOG)
* ("yes")
**
- * Write(.fcoe.cfg-ethx.USE_SYSLOG, "no")
+ * Write(.fcoe.config.USE_SYSLOG, "no")
* (true)
*
*
* Read/Sets the values defined in <tt>/etc/fcoe/config</tt>
* in an easy manner.
*/
-.fcoe
+.fcoe.config
`ag_ini(
`SysConfigFile("/etc/fcoe/config")
Modified: trunk/fcoe-client/package/yast2-fcoe-client.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/package/yast2-fcoe-client.changes?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/package/yast2-fcoe-client.changes (original)
+++ trunk/fcoe-client/package/yast2-fcoe-client.changes Tue Oct 11 13:09:59 2011
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Tue Oct 11 13:04:16 CEST 2011 - gs@suse.de
+
+- Use ini agent to write /etc/fcoe/cfg-ethx files,
+ write /etc/sysconfig/network/ifcfg-file for underlying interface
+ (bnc #705610),
+ destroy FCoE interface before removing it (bnc #719443)
+- V 2.21.9
+
+-------------------------------------------------------------------
Thu Sep 29 10:13:01 CEST 2011 - visnov@suse.cz
- set dialog title
Modified: trunk/fcoe-client/src/FcoeClient.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/FcoeClient.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/FcoeClient.ycp (original)
+++ trunk/fcoe-client/src/FcoeClient.ycp Tue Oct 11 13:09:59 2011
@@ -45,6 +45,7 @@
import "Service";
import "NetworkService";
import "String";
+import "FileUtils";
/**
* Prototypes
@@ -117,7 +118,7 @@
}
/**
- * Set write_only flag (for autoinstalation).
+ * Set write_only flag (for autoinstallation).
*/
global void SetWriteOnly(boolean value) {
write_only = value;
@@ -167,7 +168,6 @@
global boolean lldpad_started = false; // service fcoe was started
global boolean fcoe_started = false; // service lldpad was started
-global string ifcfg_file = "";
// Settings: Define all variables needed for configuration of fcoe-client
@@ -359,12 +359,12 @@
// if AUTO_VLAN is set to "yes"
if ( netcard["auto_vlan"]:"no" == "yes" )
{
- // set file name to cfg-<interface>, e.g. /etc/fcoe/eth3
+ // set file name to cfg-<interface>, e.g. /etc/fcoe/cfg-eth3
file_name = sformat( "/etc/fcoe/cfg-%1", netcard["dev_name"]:"" );
}
else
{
- // set file name to cfg-, e.g. /etc/fcoe/eth3.200
+ // set file name to cfg-, e.g. /etc/fcoe/cfg-eth3.200
file_name = sformat( "/etc/fcoe/cfg-%1", vlan_device_name );
}
@@ -396,7 +396,7 @@
}
});
content = mergestring( lines, "\n" );
- y2milestone( "Writing content: %1", content );
+ y2milestone( "Writing content: %1 to %2", content, file_name );
file_exists = SCR::Write( .target.string, file_name, content );
@@ -418,14 +418,15 @@
//
// Get status of FCoE config from /etc/fcoe/cfg-<if>.<vlan> or /etc/fcoe/cfg-<if>
//
-global map GetFcoeStatus( string vlan_device_name, map netcard )
+global map GetFcoeStatus( string vlan_device_name, string device_name )
{
map status_map = $[];
string content = "";
boolean file_exists = false;
string file_name = "";
+ string device = vlan_device_name;
- if ( vlan_device_name == "" )
+ if ( vlan_device_name == "" || device_name == "" )
{
y2error( "Interface not valid" );
return $[];
@@ -434,39 +435,36 @@
y2milestone( "VLAN channel %1 found", vlan_device_name );
file_name = sformat( "/etc/fcoe/cfg-%1", vlan_device_name );
- y2milestone( "Reading %1", file_name );
- content = (string)SCR::Read(.target.string, file_name);
- if ( content == "" || content == nil )
+ if ( !FileUtils::Exists( file_name ) )
{
- // try to read /etc/fcoe/cfg-<interface> (interface was automatically created)
- file_name = sformat( "/etc/fcoe/cfg-%1", netcard["dev_name"]:"" );
- y2milestone( "Reading %1", file_name );
- content = (string)SCR::Read(.target.string, file_name);
+ file_name = sformat( "/etc/fcoe/cfg-%1", device_name );
+
+ if ( !FileUtils::Exists( file_name ) )
+ {
+ y2warning( "Cannot read config file for %1 in /etc/fcoe", vlan_device_name );
+ Popup::Warning( sformat(_("Cannot read config file for %1"), vlan_device_name) );
+ return status_map;
+ }
+ device = device_name;
}
+ // for debugging purpose, read only needed values later
+ list values = SCR::Dir( .fcoe.cfg-ethx.value + device );
+ y2milestone( "Available values in %1: %2", file_name, values );
+
+ foreach( string var, ["FCOE_ENABLE", "DCB_REQUIRED", "AUTO_VLAN"], {
+ string value = (string)SCR::Read(.fcoe.cfg-ethx.value + device + var);
+ if ( value == nil )
+ {
+ y2warning( "Cannot read %1", var );
+ continue;
+ }
+ status_map = add( status_map, var, value );
+ });
- if ( content != "" )
- {
- list <string> lines = splitstring( content, "\n" );
- foreach( string line, (list<string>)lines, {
- line = deletechars( line, " \t" );
- foreach( string var, ["FCOE_ENABLE", "DCB_REQUIRED", "AUTO_VLAN"], {
- if ( String::StartsWith(line, var) )
- {
- status_map = add( status_map, var,
- deletechars( substring(line, size(var) + 1), "\"") );
- }
- });
+ status_map = add( status_map, "cfg_device", device );
- });
- status_map = add( status_map, "Filename", file_name );
- y2milestone( "Returning: %1", status_map );
- }
- else
- {
- y2warning( "Cannot read /etc/fcoe/%1", file_name );
- Popup::Warning( sformat(_("Cannot read /etc/fcoe/cfg-file for %1"), vlan_device_name) );
- }
+ y2milestone( "Returning: %1", status_map );
return status_map;
}
@@ -613,16 +611,12 @@
//
// dev_name device fcoe_vlan fcoe_enable dcb_required auto_vlan dcb_capable vlan_interface cfg_file
-// eth3 Ethernet card ... eth3.200 yes/no yes/no yes/no yes/no 200 /etc/fcoe/cfg-eth3.200
+// eth3 Ethernet card ... eth3.200 yes/no yes/no yes/no yes/no 200 eth3.200
//
// Detect network interface cards (hardware probe) and get status
//
global boolean DetectNetworkCards()
{
- string vlan_interface = "";
- string fcoe_vlan_interface = "";
- string dcb_capable = "";
-
list <map> netcards = (list<map>)SCR::Read(.probe.netcard);
y2milestone( "Detected netcards: %1", netcards );
@@ -652,8 +646,11 @@
map state_map = card["resource", "link", 0]:$[];
map info_map = $[];
map status_map = $[];
-
- // only call fipvlan <interface> for configured interfaces
+ string vlan_interface = "";
+ string fcoe_vlan_interface = "";
+ string dcb_capable = "";
+
+ // only call 'fipvlan <interface>' for configured interfaces
if ( state_map["state"]:false == true )
{
vlan_interface = GetVlanInterface( card["dev_name"]:"" );
@@ -669,7 +666,7 @@
if ( fcoe_vlan_interface != "" )
{
- status_map = GetFcoeStatus( fcoe_vlan_interface, card );
+ status_map = GetFcoeStatus( fcoe_vlan_interface, card["dev_name"]:"" );
}
else
{
@@ -703,7 +700,7 @@
}
info_map = add( info_map, "dcb_capable", dcb_capable ); // DCB capable
info_map = add( info_map, "vlan_interface", vlan_interface ); // VLAN interface, e.g. 200
- info_map = add( info_map, "cfg_file", status_map["Filename"]:"" ); // cfg file name, e.g. /etc/fcoe/cfg-eth3.200
+ info_map = add( info_map, "cfg_file", status_map["cfg_device"]:"" ); // part of cfg-file name, e.g. eth3.200
network_interfaces = add( network_interfaces, info_map );
} );
@@ -719,16 +716,16 @@
//
global boolean ReadFcoeConfig()
{
- list <string> options = (list<string>) SCR::Dir(.fcoe);
+ list <string> options = (list<string>) SCR::Dir(.fcoe.config);
y2milestone( "List of options in /etc/fcoe/config: %1", options );
if ( options == [] || options == nil )
return false;
- string debug_val = (string)SCR::Read(add(.fcoe, "DEBUG"));
+ string debug_val = (string)SCR::Read(add(.fcoe.config, "DEBUG"));
fcoe_general_config = add( fcoe_general_config, "DEBUG", debug_val );
- string syslog_val = (string)SCR::Read(add(.fcoe, "USE_SYSLOG"));
+ string syslog_val = (string)SCR::Read(add(.fcoe.config, "USE_SYSLOG"));
fcoe_general_config = add( fcoe_general_config, "USE_SYSLOG", syslog_val );
y2milestone( "/etc/fcoe/config read: DEBUG: %1, USE_SYSLOG: %2", debug_val, syslog_val );
@@ -737,82 +734,104 @@
}
//
-// Write /etc/fcoe/config using SCR agent
+// Write /etc/fcoe/config using fcoe_config.scr
//
global boolean WriteFcoeConfig()
{
- boolean ret = true;
-
- boolean success = (boolean)SCR::Write(add(.fcoe, "DEBUG"), GetFcoeConfig()["DEBUG"]:"" );
+ boolean success = (boolean)SCR::Write(add(.fcoe.config, "DEBUG"), GetFcoeConfig()["DEBUG"]:"" );
if ( !success )
- ret = false;
+ return false;
- success = (boolean)SCR::Write(add(.fcoe, "USE_SYSLOG"), GetFcoeConfig()["USE_SYSLOG"]:"" );
+ success = (boolean)SCR::Write(add(.fcoe.config, "USE_SYSLOG"), GetFcoeConfig()["USE_SYSLOG"]:"" );
if ( !success )
- ret = false;
+ return false;
// This is very important- it flushes the cache, and stores the configuration on the disk
- SCR::Write(.fcoe, nil);
+ success = SCR::Write(.fcoe.config, nil);
- return ret;
+ return success;
}
//
-// Write /etc/fcoe/cfg-ethx files
+// Write ifcfg-files in /etc/sysconfig/network (for FCoE VLAN interface and underlying interface)
+// using network.scr from yast2/library/network
//
-global boolean WriteCfgFiles()
+global boolean WriteSysconfigFiles( )
{
list <map> netcards = GetNetworkCards();
boolean success = true;
- string command = "";
- map output = $[];
-
- y2milestone( "Writing /etc/fcoe/cfg-ethx files" );
+
+ foreach ( map card, (list<map>)netcards, {
+ if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE && // FCoE VLAN is configured
+ card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
+ {
+ y2milestone( "Writing /etc/sysconfig/network/ifcfg-%1", card["fcoe_vlan"]:"" );
+ // write /etc/sysconfig/network/ifcfg-<fcoe-vlan-interface>, e.g. ifcfg-eth3.200
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "BOOTPROTO", "static" );
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "STARTMODE", "nfsroot" );
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "ETHERDEVICE", card["dev_name"]:"" );
+ SCR::Write(.network.value + card["fcoe_vlan"]:"" + "USERCONTROL", "no" );
+ y2milestone( "Writing /etc/sysconfig/network/ifcfg-%1", card["dev_name"]:"" );
+ // write /etc/sysconfig/network/ifcfg-<interface> (underlying interface), e.g. ifcfg-eth3
+ SCR::Write(.network.value + card["dev_name"]:"" + "BOOTPROTO", "static" );
+ SCR::Write(.network.value + card["dev_name"]:"" + "STARTMODE", "nfsroot" );
+ SCR::Write(.network.value + card["dev_name"]:"" + "NAME", card["device"]:"" );
+ }
+ } );
+ // This is very important- it flushes the cache, and stores the configuration on the disk
+ success = SCR::Write( .network, nil );
+ if ( !success )
+ {
+ y2error( "Error writing /etc/sysconfig/network/ifcfg-<fcoe-interface>" );
+ }
+ return success;
+}
+
+//
+// Write /etc/fcoe/cfg-ethx files using fcoe_cfg-ethx.scr
+//
+global boolean WriteCfgFiles()
+{
+ list <map> netcards = GetNetworkCards();
+
+ boolean success = false;
foreach ( map card, (list<map>)netcards, {
if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE && // FCoE VLAN is configured
- card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED && Modified() ) // and data are modified
+ card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
{
- string content = (string)SCR::Read( .target.string, card["cfg_file"]:"" );
- y2debug( "Original content of %1: %2", card["cfg_file"]:"", content );
-
- list <string> lines = (list<string>)splitstring( content, "\n" );
- lines = maplist( string line, lines, {
- if ( !String::StartsWith( line, "#" ) ) line = deletechars( line, " \t" );
-
- if ( String::StartsWith( line, "FCOE_ENABLE" ) )
- {
- return sformat( "FCOE_ENABLE=\"%1\"", card["fcoe_enable"]:"no" );
- }
- else if ( String::StartsWith( line, "DCB_REQUIRED" ) )
- {
- return sformat( "DCB_REQUIRED=\"%1\"", card["dcb_required"]:"no" );
- }
- else if ( String::StartsWith( line, "AUTO_VLAN" ) )
- {
- return sformat( "AUTO_VLAN=\"%1\"", card["auto_vlan"]:"no" );
- }
- else
- {
- return line;
- }
- });
- content = mergestring( lines, "\n" );
- y2milestone( "Writing content: %1", content );
+ string command = "";
+ map output = $[];
- boolean ret = SCR::Write( .target.string, card["cfg_file"]:"", content );
- if ( !ret )
+ y2milestone( "Writing /etc/fcoe/cfg-%1", card["cfg_file"]:"" );
+ success = SCR::Write(.fcoe.cfg-ethx.value + card["cfg_file"]:"" + "FCOE_ENABLE", card[ "fcoe_enable"]:"no" );
+ if ( !success )
{
- success = ret;
- y2error( "Cannot write %1", card["cfg_file"]:"" );
+ y2error( "Writing FCOE_ENABLE=%1 failed", card[ "fcoe_enable"]:"no" );
}
- else
+ success = SCR::Write(.fcoe.cfg-ethx.value + card["cfg_file"]:"" + "DCB_REQUIRED", card["dcb_required"]:"no" );
+ if ( !success )
+ {
+ y2error( "Writing DCB_REQUIRED=%1 failed", card["dcb_required"]:"no" );
+ }
+ success = SCR::Write(.fcoe.cfg-ethx.value + card["cfg_file"]:"" + "AUTO_VLAN", card["auto_vlan"]:"no" );
+ if ( !success )
{
- y2milestone( "%1 written", card["cfg_file"]:"" );
+ y2error( "Writing AUTO_VLAN=%1 failed", card["auto_vlan"]:"no" );
}
- // enable DCB app fcoe (app:0)
- if ( card["dcb_required"]:"no" == "yes" )
+ if ( card["dcb_required"]:"no" == "yes" )
{
+ // enable DCB on the interface
+ command = sformat( "dcbtool sc %1 dcb on", card["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 failed"), command ) );
+ y2error( "Command: %1 failed", command);
+ }
+ // enable App:FCoE on the interface
command = sformat( "dcbtool sc %1 app:0 e:1 a:1 w:1", card["dev_name"]:"" );
y2milestone( "Executing command: %1", command );
@@ -826,18 +845,20 @@
}
}
} );
+ // This is very important- it flushes the cache, and stores the configuration on the disk
+ success = SCR::Write( .fcoe.cfg-ethx, nil );
return success;
}
+// restart service fcoe
global boolean RestartServiceFcoe()
{
boolean ret = true;
- if ( FcoeClient::Modified() )
- {
- y2milestone( "Restarting fcoe");
- ret = Service::Restart("boot.fcoe");
- }
+
+ y2milestone( "Restarting fcoe");
+ ret = Service::Restart("boot.fcoe");
+
return ret;
}
@@ -994,13 +1015,19 @@
if( !success ) Report::Error (_("Cannot write settings for FCoE interfaces.
For details see /var/log/YaST2/y2log") );
- // restart fcoe to enable changes
if(PollAbort()) return false;
Progress::NextStage();
+ // restart fcoe to enable changes
success = RestartServiceFcoe();
/* Error message */
- if( !success ) Report::Error (_("/etc/init.d/fcoe restart failed."));
+ if( !success ) Report::Error (_("Restarting of service fcoe failed."));
+ sleep(sl);
+
+ // write ifcfg-files in /etc/sysconfig/network
+ success = WriteSysconfigFiles();
+ /* Error message */
+ if( !success ) Report::Error (_("Cannot write /etc/sysconfig/network/ifcfg-files."));
sleep(sl);
// adjust service start of lldpad and fcoe
Modified: trunk/fcoe-client/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/complex.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/complex.ycp (original)
+++ trunk/fcoe-client/src/complex.ycp Tue Oct 11 13:09:59 2011
@@ -33,6 +33,7 @@
import "Label";
import "Popup";
import "Wizard";
+import "Wizard_hw";
import "Confirm";
import "FcoeClient";
import "Service";
@@ -283,22 +284,20 @@
string vlan_interface = "";
string fcoe_vlan_interface = "";
map status_map = $[];
- boolean create_ifcfg = true;
- FcoeClient::ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2", dev_name, card["vlan_interface"]:"" );
-
- if ( Stage::initial() ) // first stage of installation - create and start FCoE VLAN interface
- {
- // headline of a popup: creating and starting Fibre Channel over Ethernet
- boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"),
- // question to the user: really create and start FCoE
- sformat( _("Do you really want to create a FCoE network
+ string ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2", dev_name, card["vlan_interface"]:"" );
+
+ // headline of a popup: creating and starting Fibre Channel over Ethernet
+ boolean ret = Popup::YesNoHeadline( _("Creating and starting FCoE on detected VLAN device"),
+ // question to the user: really create and start FCoE
+ 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 )
+ if ( ret == true )
+ {
+ if ( Stage::initial() ) // first stage of installation - create and start FCoE VLAN interface
{
- // create and start FCoE e.g. with 'fipvlan -c -s eth3'
- // revert this (in case of 'Abort') with 'vconfig rem eth3.200'
+ // create and start FCoE e.g. 'fipvlan -c -s eth3'
command = sformat( "fipvlan -c -s %1", dev_name );
y2milestone( "Executing command: %1", command );
output = (map)SCR::Execute( .target.bash_output, command );
@@ -311,43 +310,25 @@
return nil;
}
}
- else
- {
- y2milestone( "Creating FCoE VLAN interface canceled" );
- return nil;
- }
- }
- else // installed system - if VLAN already exists only start FCoE
- {
- // headline of a popup: starting Fibre Channel over Ethernet
- boolean ret = Popup::YesNoHeadline( _("Starting FCoE on detected VLAN device"),
- // question to the user: really start FCoE
- sformat( _("Do you really want to start FCoE initiator
-on discovered FCoE VLAN interface on %1?"), dev_name ) );
- if ( ret == true )
+ else // installed system - if VLAN already exists only start FCoE
{
- // if /etc/sysconfig/network/ifcfg-<vlan-interface> already exists
- // call 'ifup' for the interface (creates /proc/net/vlan/<vlan-interface>)
- if ( FileUtils::Exists( FcoeClient::ifcfg_file ) )
+ // create and start FCoE
+ command = sformat( "fipvlan -c -s %1", dev_name );
+
+ // if /etc/sysconfig/network/ifcfg-<if>.<vlan> already exists
+ // call 'ifup' for the interface (creates /proc/net/vlan/<if>.<vlan>)
+ if ( FileUtils::Exists( ifcfg_file ) )
{
- command = sformat( "ifup %1\.%2", dev_name, card["vlan_interface"]:"" );
- y2milestone( "Executing command: %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
+ string cmd_ifup = sformat( "ifup %1\.%2", dev_name, card["vlan_interface"]:"" );
+ y2milestone( "Executing command: %1", cmd_ifup );
+ output = (map)SCR::Execute( .target.bash_output, cmd_ifup );
y2milestone( "Output: %1", output );
if ( output["exit"]:255 == 0 )
{
- // start FCoE
+ // only start FCoE
command = sformat( "fipvlan -s %1", dev_name );
}
- else
- {
- command = sformat( "fipvlan -c -s %1", dev_name ); // create and start FCoE
- }
- }
- else
- {
- command = sformat( "fipvlan -c -s %1", dev_name );
}
y2milestone( "Executing command: %1", command );
@@ -360,45 +341,29 @@
return nil;
}
}
- else
- {
- y2milestone( "Starting FCoE canceled" );
- return nil;
- }
}
+ else
+ {
+ y2milestone( "Starting FCoE canceled" );
+ return nil;
+ }
+
+ // Get values and exchange list (table) entry
+ fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"", card["vlan_interface"]:"" );
- // Get new status and exchange list (table) entry
- vlan_interface = FcoeClient::GetVlanInterface( card["dev_name"]:"" );
- if ( vlan_interface == "" )
+ if ( fcoe_vlan_interface != "" )
{
- fcoe_vlan_interface = FcoeClient::NOT_AVAILABLE;
+ y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
+ // write config for FCoE VLAN interface
+ FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
+ status_map = FcoeClient::GetFcoeStatus ( fcoe_vlan_interface, card["dev_name"]:"" );
+
+ // command to be able to revert the creation of FCoE VLAN interface in case of 'Cancel'
+ FcoeClient::AddRevertCommand( sformat("fcoeadm -d %1 && vconfig rem %1", fcoe_vlan_interface ) );
}
else
{
- fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"", vlan_interface );
-
- if ( fcoe_vlan_interface != "" )
- {
- y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
- FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
- status_map = FcoeClient::GetFcoeStatus ( fcoe_vlan_interface, card );
- // store command to be able to revert the creation of FCoE VLAN interface in case of 'Abort'
- // (also if only 'fipvlan -s <interface>' is called)
- FcoeClient::AddRevertCommand( sformat("vconfig rem %1", fcoe_vlan_interface ) );
- if ( create_ifcfg )
- {
- string config = sformat( "BOOTPROTO=\"static\"\nSTARTMODE=\"nfsroot\"
-ETHERDEVICE=\"%1\"\nUSERCONTROL=\"no\"\n", dev_name );
- FcoeClient::ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1", fcoe_vlan_interface );
- SCR::Write(.target.string, FcoeClient::ifcfg_file, config);
- y2milestone( "Writing config: %1 to %2", config, FcoeClient::ifcfg_file );
- FcoeClient::AddRevertCommand( sformat( "rm %1", FcoeClient::ifcfg_file ) );
- }
- }
- else
- {
- fcoe_vlan_interface = FcoeClient::NOT_CONFIGURED;
- }
+ fcoe_vlan_interface = FcoeClient::NOT_CONFIGURED;
}
// set new values in global map network_interfaces
@@ -406,7 +371,7 @@
card["fcoe_enable"] = status_map["FCOE_ENABLE"]:"";
card["dcb_required"] = status_map["DCB_REQUIRED"]:"";
card["auto_vlan"] = status_map["AUTO_VLAN"]:"";
- card["cfg_file"] = status_map["Filename"]:"";
+ card["cfg_file"] = status_map["cfg_device"]:"";
FcoeClient::SetModified( true );
FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card );
@@ -441,45 +406,59 @@
if ( ret == true )
{
y2milestone( "Removing %1", card["fcoe_vlan"]:"" );
-
- command = sformat( "vconfig rem %1", card["fcoe_vlan"]:"") ;
+
+ // call fcoeadm -d first (bnc #719443)
+ command = sformat( "fcoeadm -d %1", card["fcoe_vlan"]:"") ;
y2milestone( "Calling %1", command );
output = (map)SCR::Execute( .target.bash_output, command );
y2milestone( "Output: %1", output );
if ( output["exit"]:255 == 0 )
{
- command = sformat( "rm %1", card["cfg_file"]:"" );
- y2milestone( "Calling %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
- y2milestone( "Output: %1", output );
- command = sformat( "rm /etc/sysconfig/network/ifcfg-%1", card["fcoe_vlan"]:"" );
+ command = sformat( "vconfig rem %1", card["fcoe_vlan"]:"") ;
y2milestone( "Calling %1", command );
output = (map)SCR::Execute( .target.bash_output, command );
y2milestone( "Output: %1", output );
+
+ if ( output["exit"]:255 == 0 )
+ {
+ command = sformat( "rm /etc/fcoe/cfg-%1", card["cfg_file"]:"" );
+ y2milestone( "Calling %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
+ command = sformat( "rm /etc/sysconfig/network/ifcfg-%1", card["fcoe_vlan"]:"" );
+ y2milestone( "Calling %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
- // set new values in global map network_interfaces
- card["fcoe_vlan"] = FcoeClient::NOT_CONFIGURED;
- card["fcoe_enable"] = "";
- card["dcb_required"] = "";
- card["auto_vlan"] = "";
- card["cfg_file"] = "";
- FcoeClient::SetModified( true );
+ // set new values in global map network_interfaces
+ card["fcoe_vlan"] = FcoeClient::NOT_CONFIGURED;
+ card["fcoe_enable"] = "";
+ card["dcb_required"] = "";
+ card["auto_vlan"] = "";
+ card["cfg_file"] = "";
+ FcoeClient::SetModified( true );
- FcoeClient::SetNetworkCardsValue( FcoeClient::current_card, card );
- y2milestone( "Current network interfaces: %1", FcoeClient::GetNetworkCards() );
+ 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), card["fcoe_vlan"]:"" );
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 3), card["fcoe_enable"]:"" );
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 4), card["dcb_required"]:"" );
- UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 5), card["auto_vlan"]:"" );
- AdjustButtons();
+ // replace values in table
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 2), card["fcoe_vlan"]:"" );
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 3), card["fcoe_enable"]:"" );
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 4), card["dcb_required"]:"" );
+ UI::ChangeWidget( `id( `interfaces), `Cell( FcoeClient::current_card, 5), card["auto_vlan"]:"" );
+ AdjustButtons();
+ }
+ else
+ {
+ Popup::Error( sformat( _("Removing of interface %1 failed"), card["fcoe_vlan"]:"") );
+ y2error( "Removing of interface %1 failed", card["fcoe_vlan"]:"" );
+ }
}
else
{
- Popup::Error( sformat( _("Removing of interface %1 failed"), card["fcoe_vlan"]:"") );
- y2error( "Removing of interface %1 failed", card["fcoe_vlan"]:"" );
+ Popup::Error( sformat( _("Destroying interface %1 failed."), card["fcoe_vlan"]:"") );
+ y2error( "Destroying interface %1 failed", card["fcoe_vlan"]:"" );
}
}
}
Modified: trunk/fcoe-client/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/dialogs.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/dialogs.ycp (original)
+++ trunk/fcoe-client/src/dialogs.ycp Tue Oct 11 13:09:59 2011
@@ -42,9 +42,11 @@
term items_fcoe = `VBox(
`VSpacing (0.4),
`Left (`RadioButton (`id ("fcoe_startup_auto"), `opt (`notify),
- "When Booting")),
+ // radio button: start service on boot
+ _("When Booting"))),
`Left (`RadioButton (`id ("fcoe_startup_manual"), `opt (`notify),
- "Manually")
+ // radio button: start service manually
+ _("Manually"))
),
`VSpacing (0.4)
);
@@ -52,9 +54,11 @@
term items_lldpad = `VBox(
`VSpacing (0.4),
`Left (`RadioButton (`id ("lldpad_startup_auto"), `opt (`notify),
- "When Booting")),
+ // radio button: start service on boot
+ _("When Booting"))),
`Left (`RadioButton (`id ("lldpad_startup_manual"), `opt (`notify),
- "Manually")
+ // radio button: start service manually
+ _("Manually"))
),
`VSpacing (0.4)
);
@@ -71,17 +75,20 @@
`Frame( (""),
`MarginBox( 10, 2,
`VBox(
- `ComboBox( `id(`fcoe), _("FCoE Enable"),
+ // combo box label: enable FCoE (yes/no)
+ `ComboBox( `id(`fcoe), _("&FCoE Enable"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true ) ]
),
`VSpacing (1),
- `ComboBox( `id(`dcb), `opt (`notify, `immediate), _("DCB Required"),
+ // combo box label: require DCB (yes/no)
+ `ComboBox( `id(`dcb), `opt (`notify), _("&DCB Required"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true ) ]
),
`VSpacing (1),
- `ComboBox( `id(`auto), _("AUTO_VLAN"),
+ // combo box label: AUTO_VLAN setting (yes/no)
+ `ComboBox( `id(`auto), _("&AUTO_VLAN"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true ) ]
)
@@ -150,16 +157,16 @@
`VBox(
`VSpacing(2.0),
`Frame (
- // Frame label - configuration settings of FCoE
+ // frame label - configuration settings of FCoE
_("Configuration Settings"),
`VBox (
- // ComboBox label
+ // combo box label
`Left(`ComboBox(`id("debug"), _("&Debug"),
[`item(`id("yes"), "yes" ),
`item(`id("no"), "no", true )
])
),
- // ComboBox label
+ // combo box label
`Left(`ComboBox(`id("syslog"), _("&Use syslog"),
[`item(`id("yes"), "yes", true ),
`item(`id("no"), "no" )
Modified: trunk/fcoe-client/src/fcoe-client_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/fcoe-client_auto.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/fcoe-client_auto.ycp (original)
+++ trunk/fcoe-client/src/fcoe-client_auto.ycp Tue Oct 11 13:09:59 2011
@@ -160,15 +160,16 @@
if ( card["fcoe_vlan"]:"" == FcoeClient::NOT_CONFIGURED )
{
+ command = sformat( "fipvlan -c -s %1", card["dev_name"]:"" );
ifcfg_file = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2", card["dev_name"]:"",
card["vlan_interface"]:"" );
// if /etc/sysconfig/network/ifcfg-<vlan-interface> already exists
// call 'ifup' for the interface (creates /proc/net/vlan/<vlan-interface>)
if ( FileUtils::Exists( ifcfg_file ) )
{
- command = sformat( "ifup %1\.%2", card["dev_name"]:"", card["vlan_interface"]:"" );
- y2milestone( "Executing command: %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
+ string cmd_ifup = sformat( "ifup %1\.%2", card["dev_name"]:"", card["vlan_interface"]:"" );
+ y2milestone( "Executing command: %1", cmd_ifup );
+ output = (map)SCR::Execute( .target.bash_output, cmd_ifup );
y2milestone( "Output: %1", output );
if ( output["exit"]:255 == 0 )
@@ -177,13 +178,10 @@
command = sformat( "fipvlan -s %1", card["dev_name"]:"" );
}
}
- else // create VLAN interface and start FCoE
- {
- command = sformat( "fipvlan -c -s %1", card["dev_name"]:"" );
- y2milestone( "Executing command: %1", command );
- output = (map)SCR::Execute( .target.bash_output, command );
- y2milestone( "Output: %1", output );
- }
+
+ y2milestone( "Executing command: %1", command );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
if ( output["exit"]:255 != 0 )
{
@@ -191,32 +189,25 @@
}
else // get FCoE VLAN interface
{
- vlan_interface = FcoeClient::GetVlanInterface( card["dev_name"]:"" );
- if ( vlan_interface == "" )
+ fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"",
+ card["vlan_interface"]:"" );
+ if ( fcoe_vlan_interface != "" )
{
- y2error( "VLAN interface not available for %1.", card["dev_name"]:"" );
+ y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
+ // create /etc/fcoe/ethx file and get values
+ FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
+ status_map = FcoeClient::GetFcoeStatus( fcoe_vlan_interface, card["dev_name"]:"" );
+ // apply modified data
+ detected_netcards[ index, "fcoe_vlan"] = fcoe_vlan_interface;
+ detected_netcards[ index, "cfg_file"] = status_map["cfg_device"]:"";
+ detected_netcards[ index, "fcoe_enable"] = status_map["FCOE_ENABLE"]:"";
+ detected_netcards[ index, "dcb_required"] = status_map["DCB_REQUIRED"]:"";
}
else
- {
- fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"",
- vlan_interface );
- if ( fcoe_vlan_interface != "" )
- {
- y2milestone( "FCoE VLAN interface %1 created/started", fcoe_vlan_interface );
- // create /etc/fcoe/ethx file and get values
- FcoeClient::CreateFcoeConfig( fcoe_vlan_interface, card );
- status_map = FcoeClient::GetFcoeStatus( fcoe_vlan_interface, card );
- // apply modified data
- detected_netcards[ index, "fcoe_vlan"] = fcoe_vlan_interface;
- detected_netcards[ index, "cfg_file"] = status_map["Filename"]:"";
- detected_netcards[ index, "fcoe_enable"] = status_map["FCOE_ENABLE"]:"";
- detected_netcards[ index, "dcb_required"] = status_map["DCB_REQUIRED"]:"";
- }
- else
- {
- y2error( "FCoE VLAN interface not configured for %1", card["dev_name"]:"" );
- }
+ {
+ y2error( "FCoE VLAN interface not configured for %1", card["dev_name"]:"" );
}
+
}
}
index = index + 1;
Modified: trunk/fcoe-client/src/fcoe-client_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/fcoe-client_finish.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/fcoe-client_finish.ycp (original)
+++ trunk/fcoe-client/src/fcoe-client_finish.ycp Tue Oct 11 13:09:59 2011
@@ -48,27 +48,41 @@
{
boolean start_services = false;
string command = "";
- y2milestone( "Copying files /etc/fcoe/* to destination" );
-
- // copy fcoe config files to destdir
- WFM::Execute (.local.bash,"test -d /etc/fcoe/ && mkdir -p '" + String::Quote(Installation::destdir) + "/etc/fcoe' && cp -a /etc/fcoe/* '" + String::Quote(Installation::destdir) + "/etc/fcoe/'");
-
- // copy sysconfig file
- command = sformat ( "cp -a %1 '%2/etc/sysconfig/network'", FcoeClient::ifcfg_file,
- String::Quote(Installation::destdir) );
- y2milestone( "Executing command: %1", command );
-
- WFM::Execute (.local.bash, command );
-
- // only enable services if any FCoE VLAN interface is enabled
list <map> netcards = FcoeClient::GetNetworkCards();
+ if ( netcards != [] )
+ {
+ y2milestone( "Copying files /etc/fcoe/* to destination" );
+ // copy fcoe config files to destdir
+ WFM::Execute (.local.bash,"test -d /etc/fcoe/ && mkdir -p '" + String::Quote(Installation::destdir) + "/etc/fcoe' && cp -a /etc/fcoe/* '" + String::Quote(Installation::destdir) + "/etc/fcoe/'");
+ }
+ else
+ {
+ y2milestone( "Nothing to do" );
+ }
+
foreach ( map card, netcards, {
+ string command = "";
+ string file_name = "";
if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE &&
card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
{
// FCoE VLAN interface is configured -> start services
start_services = true;
+
+ // copy sysconfig files
+ file_name = sformat( "/etc/sysconfig/network/ifcfg-%1\.%2",
+ card["dev_name"]:"", card["vlan_interface"]:"" );
+ command = sformat ( "cp -a %1 '%2/etc/sysconfig/network'", file_name,
+ String::Quote(Installation::destdir) );
+ y2milestone( "Executing command: %1", command );
+ WFM::Execute (.local.bash, command );
+
+ file_name = sformat( "/etc/sysconfig/network/ifcfg-%1", card["dev_name"]:"" );
+ command = sformat ( "cp -a %1 '%2/etc/sysconfig/network'", file_name,
+ String::Quote(Installation::destdir) );
+ y2milestone( "Executing command: %1", command );
+ WFM::Execute (.local.bash, command );
}
} );
Modified: trunk/fcoe-client/src/inst_fcoe-client.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/inst_fcoe-client.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/inst_fcoe-client.ycp (original)
+++ trunk/fcoe-client/src/inst_fcoe-client.ycp Tue Oct 11 13:09:59 2011
@@ -85,12 +85,14 @@
y2milestone( "Adding package open-fcoe to pool" );
PackagesProposal::AddResolvables( "fcoe", `package, ["open-fcoe"] );
// write changes to config files
- y2milestone( "Writing config files");
+ y2milestone( "Writing FCoE config files");
FcoeClient::WriteFcoeConfig();
FcoeClient::WriteCfgFiles();
// restart fcoemon
y2milestone( "Restarting FCoE" );
FcoeClient::RestartServiceFcoe();
+ y2milestone( "Writing sysconfig files" );
+ FcoeClient::WriteSysconfigFiles();
// enable start of services
y2milestone( "Enabling service start of fcoe and lldpad" );
FcoeClient::SetStartStatus( "fcoe", true );
Modified: trunk/fcoe-client/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fcoe-client/src/wizards.ycp?rev=66380&r1=66379&r2=66380&view=diff
==============================================================================
--- trunk/fcoe-client/src/wizards.ycp (original)
+++ trunk/fcoe-client/src/wizards.ycp Tue Oct 11 13:09:59 2011
@@ -30,7 +30,6 @@
textdomain "fcoe-client";
- import "Mode";
import "Sequencer";
import "Wizard";
import "CWM";
@@ -173,10 +172,7 @@
Wizard::HideBackButton();
// TODO: rename icon to yast2-fcoe-client (yast2-theme package)
- if (Mode::normal ())
- Wizard::SetDesktopTitleAndIcon("fcoe-client");
- else
- Wizard::SetTitleIcon("fcoe");
+ Wizard::SetTitleIcon("fcoe");
return CWM::Run (w, $[`abort : ReallyAbort]);
}
@@ -235,10 +231,6 @@
];
Wizard::CreateDialog();
- if (Mode::normal ())
- Wizard::SetDesktopTitleAndIcon("fcoe-client");
- else
- Wizard::SetTitleIcon("fcoe");
any ret = Sequencer::Run(aliases, sequence);
@@ -275,10 +267,6 @@
];
Wizard::CreateDialog();
- if (Mode::normal ())
- Wizard::SetDesktopTitleAndIcon("fcoe-client");
- else
- Wizard::SetTitleIcon("fcoe");
any ret = Sequencer::Run(aliases, sequence);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org