iscsiadm: how to clear discoverydb sendtargets records?

24,307 views
Skip to first unread message

Dr. Ed Morbius

unread,
Jan 27, 2011, 2:10:35 AM1/27/11
to Open iSCSI list
I've been configuring a number of CentOS 5.5 hosts against a pair of
Dell MD3220i storage arrays.

I've got one CentOS box which I'd done target discovery against the
wrong storage array.

I'd like to clear that array's records in the CentOS box's discoverdb.

I've managed to delete the node entries, but am stumped with
discoverydb:

$ sudo iscsiadm -m discoverydb -P1
SENDTARGETS:
DiscoveryAddress: 10.1.250.218,3260
No targets found.
iSNS:
No targets found.
STATIC:
No targets found.
FIRMWARE:
No targets found.

Trying the obvious fails:

$ sudo iscsiadm -m discoverydb --op=delete
iscsiadm: Invalid operation. Operation not supported.

Googling has been fruitless so far.

Clues?


Incidentally, the node deletion recipe (I sort of stumbled into it) that
semed to work was:

$ sudo iscsiadm -m node --name='record' --value='' --op=delete

I didn't find this documented in the open-iscsi README (which is
otherwise among the bettre iSCSI docs I've found).

--
Dr. Ed Morbius
Chief Scientist
Krell Power Systems Unlimited

Mike Christie

unread,
Jan 27, 2011, 2:29:11 PM1/27/11
to open-...@googlegroups.com, Dr. Ed Morbius

Where did you get the README? Was it in the tarball or in
/usr/share/docs/iscsi-initiatar-utils-$VERSION/README?

In the current README, this info should be in the iscsiadm examples (it
is also in some other parts, but I think the examples is easiest to read).

I think you want this:

-Delete discovery record. This will also delete the records for the
targets found through the discovery source.

iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete


To just remove a portal/node's record you can do

Removing iSCSI portal:

iscsiadm -m node -o delete -T iqn.2005-03.com.max -p 192.168.0.4:3260

Mike Christie

unread,
Jan 27, 2011, 3:02:51 PM1/27/11
to open-...@googlegroups.com, Dr. Ed Morbius

Oh yeah, so the commands I listed above will delete the entire discovery
or node record.

Did you just want to clear specific values in a record?

Dr. Ed Morbius

unread,
Jan 27, 2011, 4:04:25 PM1/27/11
to open-...@googlegroups.com

No. ALL evidence of the array, period. Seems to have happened my way.

Mike Christie

unread,
Jan 27, 2011, 4:29:01 PM1/27/11
to open-...@googlegroups.com

You should just use


iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete

for each discovery record to delete the discovery record and the node
records created from it.

This:


iscsiadm -m node --name='record' --value='' --op=delete

is actually a bug. You do not need the name and value arguments. To
delete all the node records you can just do


iscsiadm -m node -o delete

That is what is actually getting run when you ran your command. The name
and value params were getting ignored.

Dr. Ed Morbius

unread,
Jan 27, 2011, 3:13:01 PM1/27/11
to open-...@googlegroups.com

My bad: it *is* in the README, I just didn't see it.

On CentOS 5.5:

/usr/share/doc/iscsi-initiator-utils-6.2.0.871/README

... and also in the online open-iscsi README:

http://www.open-iscsi.org/docs/README

> In the current README, this info should be in the iscsiadm examples
> (it is also in some other parts, but I think the examples is easiest
> to read).
>
> I think you want this:
>
> -Delete discovery record. This will also delete the records for the
> targets found through the discovery source.
>
> iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete

That does delete the IQNs, but not the discovery address itself (see
output above, line under "SENDTARGETS").

My understanding of "the database" is that it's a set of files
maintained under /var/lib/iscsi. Doing a find there I see:

/var/lib/iscsi/send_targets/10.1.250.218,3260/st_config

... as the only text file.

Any harm to just blowing that away? Or in leaving it even if I never
want to talk to that array again (as in: I *really* don't want to talk
to it)?

> To just remove a portal/node's record you can do
>
> Removing iSCSI portal:
>
> iscsiadm -m node -o delete -T iqn.2005-03.com.max -p 192.168.0.4:3260

Substituting appropriate parameters, that still leaves the
DiscoveryAddress as known:

$ sudo iscsiadm -m node -o delete -T $IQN -p 10.1.250.218:3260
iscsiadm: no records found!

$ sudo iscsiadm -m discoverydb -P1
SENDTARGETS:
DiscoveryAddress: 10.1.250.218,3260
No targets found.
iSNS:
No targets found.
STATIC:
No targets found.
FIRMWARE:
No targets found.

Seeing as I can safely reinstall, I'll blow away the file and see what
happens. If the world should end, please accept my most sincere
apologies.

$ sudo rm -rf /var/lib/iscsi/send_targets/10.1.250.218,3260


$ sudo iscsiadm -m discoverydb -P1
SENDTARGETS:

No targets found.
iSNS:
No targets found.
STATIC:
No targets found.
FIRMWARE:
No targets found.

That's the result I wanted, if not the method....

Mike Christie

unread,
Jan 27, 2011, 4:51:05 PM1/27/11
to open-...@googlegroups.com
On 01/27/2011 02:13 PM, Dr. Ed Morbius wrote:
> on 13:29 Thu 27 Jan, Mike Christie (mich...@cs.wisc.edu) wrote:
>> On 01/27/2011 01:10 AM, Dr. Ed Morbius wrote:
>>> I've been configuring a number of CentOS 5.5 hosts against a pair of
>>> Dell MD3220i storage arrays.
>>>
>>> I've got one CentOS box which I'd done target discovery against the
>>> wrong storage array.
>>>
>>> I'd like to clear that array's records in the CentOS box's discoverdb.
>>>
>>> I've managed to delete the node entries, but am stumped with
>>> discoverydb:
>>>
>>> $ sudo iscsiadm -m discoverydb -P1
>>> SENDTARGETS:
>>> DiscoveryAddress: 10.1.250.218,3260
>>> No targets found.
>>> iSNS:
>>> No targets found.
>>> STATIC:
>>> No targets found.
>>> FIRMWARE:
>>> No targets found.
>>>
>>> Trying the obvious fails:
>>>
>>> $ sudo iscsiadm -m discoverydb --op=delete
>>> iscsiadm: Invalid operation. Operation not supported.

>> -Delete discovery record. This will also delete the records for the


>> targets found through the discovery source.
>>
>> iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete
>
> That does delete the IQNs, but not the discovery address itself (see
> output above, line under "SENDTARGETS").

It should delete both. I just tried it here and it worked for me.

iscsiadm -m discoverydb -P 1
SENDTARGETS:
DiscoveryAddress: 10.10.15.2,3260


iSNS:
No targets found.
STATIC:
No targets found.
FIRMWARE:
No targets found.

iscsiadm -m discoverydb -t st -p 10.10.15.2,3260 -o delete

iscsiadm -m discoverydb -P 1
SENDTARGETS:
No targets found.

The command you ran above was missing the -t st and the -p ip,port
arguments. Did you make sure you passed them in?

If it still does not work run it with debugging on "-d 8" and send all
the output.

>
> My understanding of "the database" is that it's a set of files
> maintained under /var/lib/iscsi. Doing a find there I see:
>
> /var/lib/iscsi/send_targets/10.1.250.218,3260/st_config
>
> ... as the only text file.
>
> Any harm to just blowing that away? Or in leaving it even if I never
> want to talk to that array again (as in: I *really* don't want to talk
> to it)?

Both are fine.

>
>
>> To just remove a portal/node's record you can do
>>
>> Removing iSCSI portal:
>>
>> iscsiadm -m node -o delete -T iqn.2005-03.com.max -p 192.168.0.4:3260
>
> Substituting appropriate parameters, that still leaves the
> DiscoveryAddress as known:

That command should only delete the target records. It should not affect
the discovery ones.

Hoot, Joseph

unread,
Jan 27, 2011, 2:23:06 PM1/27/11
to open-...@googlegroups.com
you can do it per NODE via `iscsiadm -m node -T <iqn_here> -o delete`

or, if you'd like to remove everything (sometimes I do this if I need to adjust an iscsid tunable for timeo or something), you can shutdown iscsi via `/etc/initi.d/iscsi stop` and then `rm -rf /var/lib/iscsi/send_targets/*; rm -rf /var/lib/iscsi/nodes/*`

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

Dr. Ed Morbius

unread,
Jan 27, 2011, 7:06:44 PM1/27/11
to open-...@googlegroups.com
on 15:29 Thu 27 Jan, Mike Christie (mich...@cs.wisc.edu) wrote:
> On 01/27/2011 03:04 PM, Dr. Ed Morbius wrote:
> >on 14:02 Thu 27 Jan, Mike Christie (mich...@cs.wisc.edu) wrote:
> >>On 01/27/2011 01:29 PM, Mike Christie wrote:
> >>>On 01/27/2011 01:10 AM, Dr. Ed Morbius wrote:

> >>>>I've got one CentOS box which I'd done target discovery against the
> >>>>wrong storage array.
> >>>>
> >>>>I'd like to clear that array's records in the CentOS box's discoverdb.

> >>>I think you want this:


> >>>
> >>>-Delete discovery record. This will also delete the records for the
> >>>targets found through the discovery source.
> >>>
> >>>iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete
> >>>
> >>>
> >>>To just remove a portal/node's record you can do
> >>>
> >>>Removing iSCSI portal:
> >>>
> >>>iscsiadm -m node -o delete -T iqn.2005-03.com.max -p 192.168.0.4:3260
> >>>

> >>Oh yeah, so the commands I listed above will delete the entire
> >>discovery or node record.
> >>
> >>Did you just want to clear specific values in a record?
> >
> >No. ALL evidence of the array, period. Seems to have happened my way.
>
> You should just use
> iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 -o delete
> for each discovery record to delete the discovery record and the
> node records created from it.
>
> This:
> iscsiadm -m node --name='record' --value='' --op=delete
> is actually a bug.

I stabbed around in the dark until the dagger came back bloody and a
body appeared on the floor. That was the iteration of the command which
worked. I'm not going to pretend it's right, and posted my question
here in part to sort out what the Right Way was.

There's not a lot of information on the database and interactiong with
it, and/or its back-end implementation. I'm not sure if this is
intentional or not, but it makes working with the DB more challenging.

> You do not need the name and value arguments. To
> delete all the node records you can just do
> iscsiadm -m node -o delete

I'd tried that. It didn't accomplish what I'd set out to do.

> That is what is actually getting run when you ran your command. The
> name and value params were getting ignored.

OK.

oleg.a.m...@gmail.com

unread,
Oct 11, 2014, 12:59:33 PM10/11/14
to open-...@googlegroups.com, dredm...@gmail.com

Hello all,

 

I've just wanted to post to this almost 4 years old thread complaining about still present bug. But I was able to pin the trouble-maker before pressing the Post button. I still want to share my problem, solution and suggestion with a future generation of googlers.

 

For the reference I'm using CentOS 7 and iscsi-initiator-utils version 6.2.0.873-21 here.

 

The problem seemed to be the same as for the topic starter 4 years ago. I couldn't get rid of the DiscoveryAddress as shown by the ' iscsiadm -m discoverydb -P1' command:

############################################

[root@rhce2 ~]# iscsiadm -m discoverydb -P1

SENDTARGETS:

DiscoveryAddress: 192.168.l.90,3260

iSNS:

No targets found.

STATIC:

No targets found.

FIRMWARE:

No targets found.

 

[root@rhce2 ~]# iscsiadm -m discoverydb -t st -p 192.168.1.90,3260 -o delete -d 8

iscsiadm: Max file limits 1024 4096

iscsiadm: Looking for config file /var/lib/iscsi/send_targets/192.168.1.90,3260

iscsiadm: Looking for config file /var/lib/iscsi/send_targets/192.168.1.90,3260 config st_config.

iscsiadm: Could not stat /var/lib/iscsi/send_targets/192.168.1.90,3260 err 2.

iscsiadm: Could not open /var/lib/iscsi/send_targets/192.168.1.90,3260: No such file or directory

iscsiadm: Discovery record [192.168.1.90,3260] not found.

 

[root@rhce2 ~]# iscsiadm -m discoverydb -P1

SENDTARGETS:

DiscoveryAddress: 192.168.l.90,3260

iSNS:

No targets found.

STATIC:

No targets found.

FIRMWARE:

No targets found.

############################################

 

Attentive reader probably noticed that the DiscoveryAddress had the lower-case ‘l’ letter instead of the number ‘1’ in the third octet of the shown IP address. So did I after copy-pasting from the console to the reply box in here. In console the font I use (FreeMono) displays the letter ‘l’ and number ‘1’ almost identically. That was where the devil hid. Usage of the ‘iscsiadm --mode discoverydb -t st -p 192.168.l.90 -o delete’ command solved the problem for me here (note the letter 'l' instead of number '1'). The following command still lets the devil in (though with errors):

 

############################################

[root@rhce2 ~]# iscsiadm --mode discovery --type sendtargets --portal 192.168.l.90

iscsiadm: Cannot resolve host 192.168.l.90. getaddrinfo error: [Name or service not known]

 

iscsiadm: cannot resolve host name 192.168.l.90

iscsiadm: cannot resolve host name 192.168.l.90

iscsiadm: Could not perform SendTargets discovery: encountered connection failure

 

[root@rhce2 ~]# iscsiadm --mode discovery -P1

SENDTARGETS:

DiscoveryAddress: 192.168.l.90,3260

iSNS:

No targets found.

STATIC:

No targets found.

FIRMWARE:

No targets found.

############################################

 


For myself I’m looking for the better font right now. And for the developers I suggest to implement input sanitization, that won’t even add incorrect values into the database.

 

Thank you,

Oleg

Reply all
Reply to author
Forward
0 new messages