Author: fehr
Date: Mon Apr 2 18:41:37 2012
New Revision: 67848
URL: http://svn.opensuse.org/viewcvs/yast?rev=67848&view=rev
Log:
update as backup
Modified:
branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioData.ycp
branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp
branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/complex.ycp
branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/dialogs.ycp
branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/widgets.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioData.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioData.ycp?rev=67848&r1=67847&r2=67848&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioData.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioData.ycp Mon Apr 2 18:41:37 2012
@@ -224,7 +224,7 @@
});
}
-global void SetAuth( string tgt, integer tpg, list<string> incom, string outgo )
+global void SetIetdAuth( string tgt, integer tpg, list<string> incom, string outgo )
{
map m = GetTgt(data,tgt,tpg);
foreach( string s, incom, ``{m=AddIncoming( m, s );});
@@ -258,6 +258,13 @@
return( HasIncomingAuth(tgt,tpg)||HasOutgoingAuth(tgt,tpg) );
}
+global map GetAuth( string tgt, integer tpg, string clnt )
+ {
+ map m = GetTgt(data,tgt,tpg);
+ return( $[ "incoming" : m["incoming",0]:[],
+ "outgoing" : m["outgoing"]:[] ] );
+ }
+
global map GetLun( string tgt, integer tpg )
{
map ret = data["tgt",tgt,tpg,"ep","lun"]:$[];
@@ -580,9 +587,9 @@
list<string> chap = [ "", "" ];
ParseAuthData( "", 0, "", chap, mutual );
if( size(mutual[0]:"")>0 && size(mutual[1]:"")>0 )
- tgmap["outgoing"] = mutual;
+ ret["outgoing"] = mutual;
if( size(chap[0]:"")>0 && size(chap[1]:"")>0 )
- tgmap["incoming"] = [ chap ];
+ ret["incoming"] = [ chap ];
foreach( string tgt, map m, endp,
{
tgmap[tgt] = $[];
@@ -786,6 +793,63 @@
return( ret );
}
+global boolean SetAuth( string tgt, integer tpg, string clnt, list inc, list out )
+ {
+ y2milestone( "SetAuth tgt:%1 tpg:%2 clnt:%3 in:%4 out:%5",
+ tgt, tpg, clnt, inc, out );
+ string cmd = "";
+ boolean ret = true;
+ if( size(tgt)==0 )
+ {
+ if( size(inc)>0 )
+ {
+ cmd = "lio_node --setchapdiscauth ";
+ ret = LogExecCmd( cmd + inc[0]:"" + " " + inc[1]:"" ) && ret;
+ }
+ else if(HasIncomingAuth("",0))
+ {
+ ret = false;
+ y2error( "SetAuth: impossible to disable discovery auth" );
+ }
+ if( size(out)>0 )
+ {
+ cmd = "lio_node --setchapdiscmutualauth ";
+ ret = LogExecCmd( cmd + out[0]:"" + " " + out[1]:"" ) && ret;
+ }
+ else if(HasOutgoingAuth("",0))
+ {
+ ret = false;
+ y2error( "SetAuth: impossible to disable discovery mutual auth" );
+ }
+ }
+ else
+ {
+ string param = tgt + " " + tpg + " " + clnt;
+ if( size(inc)>0 )
+ {
+ cmd = "lio_node --setchapauth " + param;
+ ret = LogExecCmd( cmd + inc[0]:"" + " " + inc[1]:"" ) && ret;
+ }
+ else if(HasIncomingAuth(tgt,tpg))
+ {
+ ret = false;
+ y2error( "SetAuth: impossible to disable auth" );
+ }
+ if( size(out)>0 )
+ {
+ cmd = "lio_node --setchapmutualauth " + param;
+ ret = LogExecCmd( cmd + out[0]:"" + " " + out[1]:"" ) && ret;
+ }
+ else if(HasOutgoingAuth(tgt,tpg))
+ {
+ ret = false;
+ y2error( "SetAuth: impossible to disable mutual auth" );
+ }
+ }
+ y2milestone( "SetAuth ret:%1", ret );
+ return( ret );
+ }
+
global void UpdateConfig()
{
data = ParseConfigLio();
Modified: branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp?rev=67848&r1=67847&r2=67848&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/iscsi-lio-server/src/IscsiLioServer.ycp Mon Apr 2 18:41:37 2012
@@ -172,69 +172,80 @@
}
// #157643 - reload server
-boolean reloadServer(){
-// ask user whether reload or restart server
-// #180205 - gettext problem - string wasn't marked to translate
-if (Popup::YesNo(_( "If changes have been made, the iSCSI target is not able
+boolean reloadServer()
+ {
+ return true;
+ // ask user whether reload or restart server
+ // #180205 - gettext problem - string wasn't marked to translate
+ if (Popup::YesNo(_( "If changes have been made, the iSCSI target is not able
to reload current configuration. It can only restart.
When restarting, all sessions are aborted.
Restart the target service?
-"))) Service::Restart("target");
- else {
+")))
+ Service::Restart("target");
+ else
+ {
// get changes from perl module
- map changes = IscsiLioData::GetChanges();
- list<string> connected = IscsiLioData::GetConnected();
+ map changes = IscsiLioData::GetChanges();
+ list<string> connected = IscsiLioData::GetConnected();
// delete targets
- foreach(string row, changes["del"]:[], {
+ foreach(string row, changes["del"]:[],
+ {
if (!contains(connected, row)){
- y2milestone("row to delete %1", row);
- string target=((map)SCR::Execute(.target.bash_output,
+ y2milestone("row to delete %1", row);
+ string target=((map)SCR::Execute(.target.bash_output,
// get TID number for target
"cat /proc/net/iet/volume|grep $TARGET", $["TARGET":row]))["stdout"]:"" ;
- string to_delete = splitstring( splitstring(target, " ")[0]:"", ":")[1]:"";
- y2milestone("to delete %1", to_delete);
- // delete record with that TID
- SCR::Execute(.target.bash_output, "ietadm --op delete --tid=$TID", $["TID":to_delete]);
- } else y2error("Cannot remove target %1 - already connected", row);
- });
+ string to_delete = splitstring( splitstring(target, " ")[0]:"", ":")[1]:"";
+ y2milestone("to delete %1", to_delete);
+ // delete record with that TID
+ SCR::Execute(.target.bash_output, "ietadm --op delete --tid=$TID", $["TID":to_delete]);
+ }
+ else
+ y2error("Cannot remove target %1 - already connected", row);
+ });
// add a new target
- foreach(string row, changes["add"]:[], {
+ foreach(string row, changes["add"]:[],
+ {
y2milestone("row to add %1", row);
- // create new target
- SCR::Execute(.target.bash_output, "ietadm --op new --tid=0 --params Name=$NAME", $["NAME":row]);
- string target=((map)SCR::Execute(.target.bash_output,
- "cat /proc/net/iet/volume|grep $TARGET", $["TARGET":row]))["stdout"]:"" ;
- // get TID of that target
+ // create new target
+ SCR::Execute(.target.bash_output, "ietadm --op new --tid=0 --params Name=$NAME", $["NAME":row]);
+ string target=((map)SCR::Execute(.target.bash_output,
+ "cat /proc/net/iet/volume|grep $TARGET", $["TARGET":row]))["stdout"]:"" ;
+ // get TID of that target
string to_add = splitstring( splitstring(target, " ")[0]:"", ":")[1]:"";
y2milestone("to add %1", to_add);
- list<string> lun = [];
- list <string> secret = [];
- // add authentication to target
- foreach( map conf_row, (list