[stgt] Strange sendtargets behaviour
Chris Webb
chris at arachsys.com
Wed Aug 26 13:44:23 CEST 2009
I've just seen this same error with tgtd only exporting a small number of
targets (66):
# iscsiadm -m discovery -t sendtargets -p 0a2bc790-aab9-45bd-ad58-6fd7d9b2aae7.storage.elastichosts.com | wc -l
iscsiadm: Cannot resolve host 172.16.226.12. getaddrinfo error: [Servname not supported for ai_socktype]
iscsiadm: cannot resolve 172.16.226.12
iscsiadm: failed to add default portal, ignoring target iqn.2008-03.com.elastichosts:ad0b32d2-c220-4be5-a609-5ea063f0a4cc:176fe3df-bead-4871-bd4b-dfce6d9930f7
iscsiadm: failed to add target record
iscsiadm: This command will remove the record [iface: default, target: iqn.2008-03.com.elastichosts:ad0b32d2-c220-4be5-a609-5ea063f0a4cc:8f3d70f4-9242-4754-853f-1c2d7a1560ab, portal: 172.16.226.12,3260], but a session is using it. Logout session then rerun command to remove record.
iscsiadm: This command will remove the record [iface: default, target: iqn.2008-03.com.elastichosts:ad0b32d2-c220-4be5-a609-5ea063f0a4cc:3a12639e-71d5-4ad1-8682-878f6da3e802, portal: 172.16.226.12,3260], but a session is using it. Logout session then rerun command to remove record.
iscsiadm: This command will remove the record [iface: default, target: iqn.2008-03.com.elastichosts:ad0b32d2-c220-4be5-a609-5ea063f0a4cc:2c7e95f0-f796-4f31-b2b7-455ef6146e12, portal: 172.16.226.12,3260], but a session is using it. Logout session then rerun command to remove record.
56
[restart tgtd on remote host]
# iscsiadm -m discovery -t sendtargets -p 0a2bc790-aab9-45bd-ad58-6fd7d9b2aae7.storage.elastichosts.com | wc -l
66
(To explain what's going on with the getaddrinfo error from iscsiadm, it does
the equivalent of
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main(int argc, char **argv) {
int rc;
char *host, *port, ip[256];
struct addrinfo hints, *res;
if (argc != 3) {
fprintf(stderr, "Usage: %s HOST PORT\n", argv[0]);
exit(64);
}
host = argv[1];
port = argv[2];
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if ((rc = getaddrinfo(host, port, &hints, &res))) {
fprintf(stderr, "Cannot resolve host %s. getaddrinfo error: [%s]\n",
host, gai_strerror(rc));
} else {
getnameinfo((struct sockaddr *) res->ai_addr, res->ai_addrlen, ip,
sizeof(ip), NULL, 0, NI_NUMERICHOST);
printf("Host %s resolved to %s\n", host, ip);
freeaddrinfo(res);
}
exit(rc);
}
with the supplied host and port. The mysterious 'Servname not supported for
ai_socktype' just means that a corrupted string has been supplied for the port
number.)
Cheers,
Chris.
--
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