[stgt] [PATCH] Remove deletion of accounts from tgt-admin

Paul Ryan pajryan at gmail.com
Sun Oct 23 08:04:13 CEST 2011


The previous patch to return an error code if a non-existent user is
deleted has broken tgt-admin -e when the currently running config or
account list is empty.  This can happen when booting or service restart.

# tgt-admin -e -v
tgtadm -C 0 --op update --mode sys --name iSNSAccessControl -v Off
tgtadm -C 0 --op update --mode sys --name iSNSServerPort -v 3205
tgtadm -C 0 --op update --mode sys --name iSNS -v Off
# Adding target: iqn.1970-01.com.example:image1
tgtadm -C 0 --lld iscsi --op new --mode target --tid 1 -T iqn.1970-01.com.example:image1
tgtadm -C 0 --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /tmp/disk1.img  
# Write cache is enabled (default) for lun 1.
tgtadm -C 0 --lld iscsi --mode account --op delete --user=user1
tgtadm: can't find the account
Command:
        tgtadm -C 0 --lld iscsi --mode account --op delete --user=user1
exited with code: 22.
# 

The current behaviour is to delete the user even when it knows it does
not exits in the hash table. Previously this was ok as it did not return
and error code, now it does.

Signed-off-by: Paul Ryan <pajryan at gmail.com>
---
 scripts/tgt-admin |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 9f34022..39e8c57 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -711,7 +711,6 @@ sub process_options {
 			check_value($userpass[1]);
 			# Only delete or create account if it doesn't already exist
 			if (! exists $existing_accounts{$userpass[0]} ) {
-				execute("tgtadm -C $control_port --lld $driver --mode account --op delete --user=$userpass[0]");
 				execute("tgtadm -C $control_port --lld $driver --mode account --op new --user=$userpass[0] --password=$userpass[1]");
 				$existing_accounts{$userpass[0]} = 1;
 			}
@@ -729,7 +728,6 @@ sub process_options {
 		check_value($userpass[1]);
 		# Only delete or create account if it doesn't already exist
 		if (! exists $existing_accounts{$userpass[0]} ) {
-			execute("tgtadm -C $control_port --lld $driver --mode account --op delete --user=$userpass[0]");
 			execute("tgtadm -C $control_port --lld $driver --mode account --op new --user=$userpass[0] --password=$userpass[1]");
 			$existing_accounts{$userpass[0]} = 1;
 		}
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list