Skip to content

Commit

Permalink
let startup-mode unchanged when using 'Add' button for discovery (bnc…
Browse files Browse the repository at this point in the history
… #886796)
  • Loading branch information
gabi2 committed Oct 16, 2014
1 parent 0f8b410 commit 705960b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/IscsiClientLib.ycp
Expand Up @@ -880,9 +880,9 @@ void CallConfigScript()
});
}

global string GetDiscoveryCmd( string ip, string port, boolean fw)
global string GetDiscoveryCmd( string ip, string port, boolean fw, boolean only_new)
{
y2milestone( "GetDiscoveryCmd ip:%1 port:%2 fw:%3", ip, port, fw);
y2milestone( "GetDiscoveryCmd ip:%1 port:%2 fw:%3 only_new: %4", ip, port, fw, only_new);
string command = "-m discovery -P 1";
if( useISNS() )
command = command + " -t isns";
Expand All @@ -897,6 +897,8 @@ global string GetDiscoveryCmd( string ip, string port, boolean fw)
tgt = "fw";
command = command + sformat( " -t %4 %3 -p %1:%2", ip, port,
mergestring(ifs," "), tgt);
if( only_new )
command = command + " -o new";
}
command = GetAdmCmd(command);
y2milestone( "GetDiscoveryCmd %1", command );
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs.ycp
Expand Up @@ -123,7 +123,7 @@ map<string, map <string, any> > widgets = $[
"custom_widget" :
`VBox(
`Table(`id(`targets), `opt(`notify, `immediate),
`header(_("Portal Address"), _("Target Name"), _("Connected")),
`header(_("Interface"), _("Portal Address"), _("Target Name"), _("Connected")),
[]
),
`Left(`HBox(
Expand Down
13 changes: 11 additions & 2 deletions src/widgets.ycp
Expand Up @@ -472,12 +472,21 @@ if (!IscsiClientLib::useISNS())
//y2internal("auth: %1/%2, %3/%4", user_in, pass_in, user_out, pass_out);
bg_finish=false;
// ` with authentication
string command = IscsiClientLib::GetDiscoveryCmd(ip,port,false);
# Check current_tab (dialogs.rb) here. If it's "client", i.e. the
# 'Add' button at 'Connected Targets' is used, create discovery
# command with option --new. The start-up mode for already connected
# targets won't change then (fate #317874, bnc #886796).
boolean option_new = false;
if( current_tab=="client" )
{
option_new = true;
}
string command = IscsiClientLib::GetDiscoveryCmd(ip,port,false, option_new);
list<string>trg_list = runInBg( command );
while(!bg_finish){};
if( size(trg_list)==0 )
{
command = IscsiClientLib::GetDiscoveryCmd(ip,port,true);
command = IscsiClientLib::GetDiscoveryCmd(ip,port,true, option_new);
trg_list = runInBg( command );
while(!bg_finish){};
}
Expand Down

0 comments on commit 705960b

Please sign in to comment.