|
Packit Service |
646995 |
/*
|
|
Packit Service |
646995 |
* iSCSI error helpers
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Copyright (C) 2011 Mike Christie
|
|
Packit Service |
646995 |
* Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
|
Packit Service |
646995 |
* maintained by open-iscsi@googlegroups.com
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
646995 |
* it under the terms of the GNU General Public License as published
|
|
Packit Service |
646995 |
* by the Free Software Foundation; either version 2 of the License, or
|
|
Packit Service |
646995 |
* (at your option) any later version.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* This program is distributed in the hope that it will be useful, but
|
|
Packit Service |
646995 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
646995 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
646995 |
* General Public License for more details.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* See the file COPYING included with this distribution for more details.
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
#include "stdlib.h"
|
|
Packit Service |
646995 |
#include "iscsi_err.h"
|
|
Packit Service |
646995 |
#include "log.h"
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
enum iscsi_error_list iscsi_err;
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
static char *iscsi_err_msgs[] = {
|
|
Packit Service |
646995 |
/* 0 */ "",
|
|
Packit Service |
646995 |
/* 1 */ "unknown error",
|
|
Packit Service |
646995 |
/* 2 */ "session not found",
|
|
Packit Service |
646995 |
/* 3 */ "no available memory",
|
|
Packit Service |
646995 |
/* 4 */ "encountered connection failure",
|
|
Packit Service |
646995 |
/* 5 */ "encountered iSCSI login failure",
|
|
Packit Service |
646995 |
/* 6 */ "encountered iSCSI database failure",
|
|
Packit Service |
646995 |
/* 7 */ "invalid parameter",
|
|
Packit Service |
646995 |
/* 8 */ "connection timed out",
|
|
Packit Service |
646995 |
/* 9 */ "internal error",
|
|
Packit Service |
646995 |
/* 10 */ "encountered iSCSI logout failure",
|
|
Packit Service |
646995 |
/* 11 */ "iSCSI PDU timed out",
|
|
Packit Service |
646995 |
/* 12 */ "iSCSI driver not found. Please make sure it is loaded, and retry the operation",
|
|
Packit Service |
646995 |
/* 13 */ "daemon access denied",
|
|
Packit Service |
646995 |
/* 14 */ "iSCSI driver does not support requested capability.",
|
|
Packit Service |
646995 |
/* 15 */ "session exists",
|
|
Packit Service |
646995 |
/* 16 */ "Unknown request",
|
|
Packit Service |
646995 |
/* 17 */ "iSNS service not supported",
|
|
Packit Service |
646995 |
/* 18 */ "could not communicate to iscsid",
|
|
Packit Service |
646995 |
/* 19 */ "encountered non-retryable iSCSI login failure",
|
|
Packit Service |
646995 |
/* 20 */ "could not connect to iscsid",
|
|
Packit Service |
646995 |
/* 21 */ "no objects found",
|
|
Packit Service |
646995 |
/* 22 */ "sysfs lookup failure",
|
|
Packit Service |
646995 |
/* 23 */ "host not found",
|
|
Packit Service |
646995 |
/* 24 */ "iSCSI login failed due to authorization failure",
|
|
Packit Service |
646995 |
/* 25 */ "iSNS query failed",
|
|
Packit Service |
646995 |
/* 26 */ "iSNS registration failed",
|
|
Packit Service |
646995 |
/* 27 */ "operation not supported",
|
|
Packit Service |
646995 |
/* 28 */ "device or resource in use",
|
|
Packit Service |
646995 |
/* 29 */ "operation failed but retry may succeed",
|
|
Packit Service |
646995 |
/* 30 */ "unknown discovery type",
|
|
Packit Service |
646995 |
/* 31 */ "child process terminated",
|
|
Packit Service |
646995 |
/* 32 */ "target likely not connected",
|
|
Packit Service |
646995 |
};
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
char *iscsi_err_to_str(int err)
|
|
Packit Service |
646995 |
{
|
|
Packit Service |
646995 |
if (err >= ISCSI_MAX_ERR_VAL || err < 0) {
|
|
Packit Service |
646995 |
log_error("invalid error code %d", err);
|
|
Packit Service |
646995 |
return NULL;
|
|
Packit Service |
646995 |
}
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
return iscsi_err_msgs[err];
|
|
Packit Service |
646995 |
}
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
void iscsi_err_print_msg(int err)
|
|
Packit Service |
646995 |
{
|
|
Packit Service |
646995 |
if (err >= ISCSI_MAX_ERR_VAL || err < 0) {
|
|
Packit Service |
646995 |
log_error("invalid error code %d", err);
|
|
Packit Service |
646995 |
return;
|
|
Packit Service |
646995 |
}
|
|
Packit Service |
646995 |
log_error("initiator reported error (%d - %s)", err,
|
|
Packit Service |
646995 |
iscsi_err_msgs[err]);
|
|
Packit Service |
646995 |
}
|