Author: gs
Date: Mon Jul 4 10:19:00 2011
New Revision: 64714
URL: http://svn.opensuse.org/viewcvs/yast?rev=64714&view=rev
Log:
support for AutoYaST added
Modified:
branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/FcoeClient.ycp
branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client.desktop
branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client_auto.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=64714&r1=64713&r2=64714&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 Mon Jul 4 10:19:00 2011
@@ -207,8 +207,8 @@
}
// map containing information about start of services at boot
-map service_start = $[ "fcoe":false,
- "lldpad":false ];
+map service_start = $[ "fcoe":true,
+ "lldpad":true ];
// map containing information about networks cards and VLAN, FCoE and DCB status
list <map> network_interfaces = [];
@@ -470,7 +470,7 @@
global void SetStartStatus( string service, boolean status )
{
- y2milestone( "Setting status of %1 to %2", service, status );
+ y2milestone( "Starting service %1 on boot: %2", service, status );
service_start[ service ] = status;
}
@@ -900,7 +900,14 @@
*/
global boolean Import (map settings)
{
- // TODO FIXME: your code here (fill the above mentioned variables)...
+ // fill variables
+ fcoe_general_config = (map )settings["fcoe_cfg"]:$[ ];
+ network_interfaces = (list <map>)settings["interfaces"]:[];
+ service_start = (map )settings["service_start"]:$[ ];
+
+ SetModified( true );
+ y2milestone ("Configuration has been imported");
+
return true;
}
@@ -911,8 +918,12 @@
*/
global map Export ()
{
- // TODO FIXME: your code here (return the above mentioned variables)...
- return $[];
+ // return map containing current settings
+ return $[
+ "fcoe_cfg" : fcoe_general_config,
+ "interfaces" : network_interfaces,
+ "service_start" : service_start
+ ];
}
/**
@@ -921,9 +932,36 @@
*/
global list Summary()
{
- // TODO FIXME: your code here...
+ string summary = "";
+ map fcoe_config = $[];
+ list <map> netcards = [];
+ map service_start = $[];
+
/* Configuration summary text for autoyast */
- return [ _("Configuration summary..."), [] ];
+ summary = Summary::AddLine( summary, _("<b>General FCoE configuration</b>") );
+ fcoe_config = FcoeClient::GetFcoeConfig();
+ // options from logfile, not meant for translation
+ summary = Summary::AddLine( summary, sformat( "DEBUG: %1", fcoe_config["DEBUG"]:"" ) );
+ summary = Summary::AddLine( summary, sformat( "USE_SYSLOG: %1", fcoe_config["USE_SYSLOG"]:"" ) );
+ summary = Summary::AddLine( summary, _("<b>Interfaces</b>") );
+ netcards = FcoeClient::GetNetworkCards();
+ foreach ( map card, netcards, {
+ summary = Summary::AddLine( summary, sformat( "%1: %2 %3: %4",
+ // network card, e.g. eth0
+ _("<i>Netcard</i>:"), card["dev_name"]:"",
+ // nothing to translate here
+ "<i>FCoE VLAN</i>", card["fcoe_vlan"]:"") );
+
+ } );
+ service_start = FcoeClient::GetStartStatus();
+ summary = Summary::AddLine( summary, _("<b>Starting of services</b>") );
+
+ // starting of service "fcoe" at boot time is enabled or disabled
+ summary = Summary::AddLine( summary, sformat( "fcoe: %1", (service_start["fcoe"]:false)?_("enabled"):_("disabled") ));
+ // starting of service "lldpad" at boot time is enabled or disabled
+ summary = Summary::AddLine( summary, sformat( "lldpad: %1", (service_start["lldpad"]:false)?_("enabled"):_("disabled") ) );
+
+ return [ summary, [] ];
}
/**
@@ -943,8 +981,8 @@
*/
global map AutoPackages()
{
- // TODO FIXME: your code here...
- return $[ "install":[], "remove":[] ];
+ // installation of open-fcoe required
+ return $[ "install":["open-fcoe"], "remove":[] ];
}
/* EOF */
Modified: branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client.desktop
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client.desktop?rev=64714&r1=64713&r2=64714&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client.desktop (original)
+++ branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client.desktop Mon Jul 4 10:19:00 2011
@@ -11,10 +11,11 @@
X-SuSE-YaST-Group=Net_advanced
X-SuSE-YaST-Argument=
X-SuSE-YaST-RootOnly=true
-X-SuSE-YaST-AutoInst=
+X-SuSE-YaST-AutoInst=all
X-SuSE-YaST-Geometry=
X-SuSE-YaST-SortKey=
X-SuSE-YaST-AutoInstResource=fcoe-client
+X-SuSE-YaST-AutoInstClonable=true
Icon=fcoe
Exec=/sbin/yast2 fcoe-client
Modified: branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client_auto.ycp?rev=64714&r1=64713&r2=64714&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client_auto.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/fcoe-client/src/fcoe-client_auto.ycp Mon Jul 4 10:19:00 2011
@@ -93,12 +93,57 @@
ret = FcoeClient::Read();
Progress::set (progress_orig);
}
-/* Write givven settings */
+/* Write given settings */
else if (func == "Write") {
import "Progress";
+ boolean write = true;
boolean progress_orig = Progress::set (false);
- FcoeClient::SetWriteOnly (true);
- ret = FcoeClient::Write();
+
+ // prepare for AutoYaST: check imported data and if required create the
+ // FCoE VLAN interfaces before calling FCoEClient::Write()
+
+ list<map> netcards = FcoeClient::GetNetworkCards();
+ foreach ( map card, netcards, {
+ string vlan_interface = "";
+ string fcoe_vlan_interface = "";
+ string command = "";
+ map output = $[];
+
+ if ( card["fcoe_vlan"]:"" != FcoeClient::NOT_AVAILABLE &&
+ card["fcoe_vlan"]:"" != FcoeClient::NOT_CONFIGURED )
+ {
+ // create and start FcoE
+ command = sformat( "fipvlan -c -s %1", card["dev_name"]:"" );
+ output = (map)SCR::Execute( .target.bash_output, command );
+ y2milestone( "Output: %1", output );
+ if ( output["exit"]:255 != 0 )
+ {
+ y2error( "Cannot create and start FCoE on %1", card["dev_name"]:"" );
+ write = false; // don't write configuration
+ }
+ else
+ {
+ // check FCoE VLAN interface
+ vlan_interface = FcoeClient::GetVlanInterface( card["dev_name"]:"" );
+ fcoe_vlan_interface = FcoeClient::GetFcoeVlanInterface( card["dev_name"]:"",
+ vlan_interface );
+ if ( fcoe_vlan_interface != card["fcoe_vlan"]:"" )
+ {
+ y2error( "FCoE VLAN interfaces differ. Created: %1, imported: %2",
+ fcoe_vlan_interface, card["fcoe_vlan"]:"" );
+ write = false; // don't write configuration
+ }
+ }
+ }
+ });
+ if ( write )
+ {
+ ret = FcoeClient::Write();
+ }
+ else // don't continue in case of error
+ {
+ ret = false;
+ }
Progress::set (progress_orig);
}
/**
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org