This patch adds some codes to output logs to reflect the return value
of iscsid_req_wait() for outputting logging.
Please give me a feedback if any.
-- Yangkook Kim
Signed-off-by: Yangkook Kim yangkook...@gmail.com
---
--- a/usr/util.c2009-11-12 06:22:10.0 +0900
+++ b/usr/util.c2009-11-12 06:28:45.0 +0900
@@ -121,6 +121,34 @@
#define MAXSLEEP 128
+void iscsid_handle_error(mgmt_ipc_err_e err)
+{
+ static char *err_msgs[] = {
+ /* 0 */ ,
+ /* 1 */ unknown error,
+ /* 2 */ not found,
+ /* 3 */ no available memory,
+ /* 4 */ encountered connection failure,
+ /* 5 */ encountered iSCSI login failure,
+ /* 6 */ encountered iSCSI database failure,
+ /* 7 */ invalid parameter,
+ /* 8 */ connection timed out,
+ /* 9 */ internal error,
+ /* 10 */ encountered iSCSI logout failure,
+ /* 11 */ iSCSI PDU timed out,
+ /* 12 */ iSCSI driver not found. Please make sure it
is loaded, and retry the operation,
+ /* 13 */ daemon access denied,
+ /* 14 */ iSCSI driver does not support requested capability.,
+ /* 15 */ already exists,
+ /* 16 */ Unknown request,
+ /* 17 */ encountered iSNS failure,
+ /* 18 */ could not communicate to iscsid,
+ /* 19 */ encountered non-retryable iSCSI login failure,
+ /* 20 */ could not connect to iscsid,
+ };
+ log_error(initiator reported error (%d - %s), err, err_msgs[err]);
+}
+
static mgmt_ipc_err_e iscsid_connect(int *fd)
{
int nsec;
@@ -231,7 +259,18 @@
err = iscsid_req_by_rec_async(cmd, rec, fd);
if (err)
return err;
- return iscsid_req_wait(cmd, fd);
+ err = iscsid_req_wait(cmd, fd);
+ if (err) {
+ log_error(Could not login to [iface: %s, target: %s,
+ portal: %s,%d]: , rec-iface.name,
+ rec-name, rec-conn[0].address,
+ rec-conn[0].port);
+ } else
+ printf(Login to [iface: %s, target: %s, portal:
+ %s,%d]: successful\n, rec-iface.name,
+ rec-name, rec-conn[0].address,
+ rec-conn[0].port);
+ return err;
}
int iscsid_req_by_sid_async(iscsiadm_cmd_e cmd, int sid, int *fd)
@@ -312,34 +351,6 @@
iface_setup_defaults(rec-iface);
}
-void iscsid_handle_error(mgmt_ipc_err_e err)
-{
- static char *err_msgs[] = {
- /* 0 */ ,
- /* 1 */ unknown error,
- /* 2 */ not found,
- /* 3 */ no available memory,
- /* 4 */ encountered connection failure,
- /* 5 */ encountered iSCSI login failure,
- /* 6 */ encountered iSCSI database failure,
- /* 7 */ invalid parameter,
- /* 8 */ connection timed out,
- /* 9 */ internal error,
- /* 10 */ encountered iSCSI logout failure,
- /* 11 */ iSCSI PDU timed out,
- /* 12 */ iSCSI driver not found. Please make sure it
is loaded, and retry the operation,
- /* 13 */ daemon access denied,
- /* 14 */ iSCSI driver does not support requested capability.,
- /* 15 */ already exists,
- /* 16 */ Unknown request,
- /* 17 */ encountered iSNS failure,
- /* 18 */ could not communicate to iscsid,
- /* 19 */ encountered non-retryable iSCSI login failure,
- /* 20 */ could not connect to iscsid,
- };
- log_error(initiator reported error (%d - %s), err, err_msgs[err]);
-}
-
int __iscsi_match_session(node_rec_t *rec, char *targetname,
char *address, int port, struct iface_rec *iface)
{
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
--- a/usr/util.c 2009-11-12 06:22:10.0 +0900
+++ b/usr/util.c 2009-11-12 06:28:45.0 +0900
@@ -121,6 +121,34 @@
#define MAXSLEEP 128
+void iscsid_handle_error(mgmt_ipc_err_e err)
+{
+ static char *err_msgs[] = {
+ /* 0 */ ,
+ /* 1 */ unknown error,
+ /* 2 */ not found,
+ /* 3 */ no available memory,
+ /* 4 */ encountered connection failure,
+ /* 5 */ encountered iSCSI login failure,
+ /* 6 */ encountered iSCSI database failure,
+ /* 7 */ invalid parameter,
+ /* 8 */ connection timed out,
+ /* 9 */ internal error,
+ /* 10 */ encountered iSCSI logout