Mike Christie wrote:
> Mike Christie wrote:
>> HIMANSHU wrote:
>>> Exactly Ulrich,there can be a better approach.
>>> I am now having iscsiadm version 2.0-870,but still I am having a
>>> problem in case of 2 targets having different NODE authentication.
>>>
>>> My scenario
>>>
>>> Suppose 2 targets (having different NODE AUTHENTICATION,assuming same
>>> DISCOVERY AUTHENTICATION) from same target machine(say 30.12) are
>>> logged in.I set up node.startup=automatic in both cases.
>>>
>>> My observation
>>>
>>> If I restart initiator machine,re-login can be possible in case of
>>> last logged in target only,not both of them.
>>>
>>> Steps performed
>>>
>>> 1. Discover machine using -o new -o delete->Enter Node credentials for
>>> 1st target from the list shown->Discovery again as iscsid.conf is now
>>> having node credentials of target1->login to target1->making
>>> node.startup=automatic
>>>
>>> 2. Discover machine using -o new -o delete->Enter different Node
>>> credentials for 2nd target from the list shown->Discovery using -o
>>> update as iscsid.conf is now having node credentials of target2->login
>>> to target2->making node.startup=automatic
>>> (using -o update overwrites my node.startup setting of target1,so I
>>> have to again make node.startup of target1 to automatic.without -o
>>> update,it wont allow me to login as I need to change iscsid.conf to
>>> target2's credentials.)
>> If you do this:
>>
>> 1. set DISCOVERY AUTHENTICATION in iscsid.conf.
>> 2. run discovery iscsiadm -m discovery -t st -p ip
>> 3. set NODE AUTHENTICATION for target1 found
>> iscsiadm -m node -T target1 -p ip:port -o update -n 
>> node.session.auth.username -v user
>> iscsiadm -m node -T target1 -p ip:port -o update -n 
>> node.session.auth.password -v pass
>>
>> 4.A If other target or portal or both is found through the same 
>> discovery address and was just found then all you have to do is run 
>> those iscsiadm -m node commands for the second target (you do not need 
>> to run discovery again):
>>
>> iscsiadm -m node -T target2 -p ip2:port -o update -n 
>> node.session.auth.username -v user
>> iscsiadm -m node -T target2 -p ip2:port -o update -n 
>> node.session.auth.password -v pass
>>
>>
>> 4.B if the other target or portal or both is found through a different 
>> discovery address but using the same DISCOVERY AUTHENTICATION then do 
>> discovery to the other address:
>> iscsiadm -m discovery -t st -p ip2
>> If for some reason the other discovery address also gives you the 
>> targets and portals from the other discovery address ip, then pass in 
>> the -o new -o delete to the discovery command.
>>
>>
>> Then run iscsiadm -m node -o update .... to set the NODE AUTHENTICATION 
>> for those targets.
>>
>> 4.C if the other target or portal or both is found through a different 
>> discovery address but using a differenet DISCOVERY AUTHENTICATION then 
>> you have to edit the discovery chap settings in iscsid.conf and then run 
>> the discovery command
>> iscsiadm -m discovery -t st -p ip2
>>
>> If for some reason the other discovery address also gives you the 
>> targets and portals from the other discovery address ip, then pass in 
>> the -o new -o delete to the discovery command.
>>
>> Then just run iscsiadm -m node -o update .... to set the chap settings 
>> for the targets found in there.
>>
>>
>> 5. if then later on you want to discover new targets then run
>> iscsiadm -m discovery -t st -p ip -o new -o delete
>> And then run iscsiadm -m node -o update .... to set the chap settings 
>> for what was found.
>>
> 
> It looks like there is a bug. If you wanted to run the discovery command 
> again but use what was in /etc/iscsi/send_targets/ip
> This will not work.
> 
> I will fix this up.
> 

With the attached patch, if you run

iscsiadm -m discovery -p ip:port

(note no -t st is needed since the discovery type is in the db).

then we do discovery using what is in 
/etc/iscsi/send_targets/ip,port/*config

So if you had different discovery auth settings stored in there then 
they would just be used.

The problem is that if you did not pass in arguments like this:
iscsiadm -m discovery -p ip:port
it used to default to the same command as "iscsiadm -m discovery -p 
ip:port -o show". So I am not sure if we can do this safely. Maybe need 
to add some other code.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 5964e39..694a525 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1978,35 +1978,42 @@ main(int argc, char **argv)
 					rc = -1;
 					goto out;
 				}
-				if (do_login &&
+
+				if (op == OP_SHOW) {
+					if (!idbm_print_discovery_info(&drec,
+								do_show)) {
+						log_error("no records found!");
+						rc = -1;
+					}
+				} else if (op == OP_DELETE) {
+					if (idbm_delete_discovery(&drec)) {
+						log_error("unable to delete "
+							   "record!");
+						rc = -1;
+					}
+				} else if ((do_login || op == OP_NOOP) &&
 				    drec.type == DISCOVERY_TYPE_SENDTARGETS) {
 					do_sendtargets(&drec, &ifaces,
 							info_level, do_login,
 							op);
-				} else if (do_login &&
+				} else if ((do_login || op == OP_NOOP) &&
 					   drec.type == DISCOVERY_TYPE_SLP) {
 					log_error("SLP discovery is not fully "
 						  "implemented yet.");
 					rc = -1;
 					goto out;
-				} else if (do_login &&
+				} else if ((do_login || op == OP_NOOP) &&
 					   drec.type == DISCOVERY_TYPE_ISNS) {
 					log_error("iSNS discovery is not fully "
 						  "implemented yet.");
 					rc = -1;
 					goto out;
-				} else if (op == OP_NOOP || op == OP_SHOW) {
+				} else if (op == OP_SHOW) {
 					if (!idbm_print_discovery_info(&drec,
 								do_show)) {
 						log_error("no records found!");
 						rc = -1;
 					}
-				} else if (op == OP_DELETE) {
-					if (idbm_delete_discovery(&drec)) {
-						log_error("unable to delete "
-							   "record!");
-						rc = -1;
-					}
 				} else {
 					log_error("operation is not supported.");
 					rc = -1;

Reply via email to