TESTS: When task management functions fail, print the reason why it failed.
This commit is contained in:
19
lib/sync.c
19
lib/sync.c
@@ -158,7 +158,7 @@ int iscsi_logout_sync(struct iscsi_context *iscsi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iscsi_task_mgmt_sync_cb(struct iscsi_context *iscsi _U_, int status,
|
iscsi_task_mgmt_sync_cb(struct iscsi_context *iscsi, int status,
|
||||||
void *command_data, void *private_data)
|
void *command_data, void *private_data)
|
||||||
{
|
{
|
||||||
struct iscsi_sync_state *state = private_data;
|
struct iscsi_sync_state *state = private_data;
|
||||||
@@ -173,6 +173,23 @@ iscsi_task_mgmt_sync_cb(struct iscsi_context *iscsi _U_, int status,
|
|||||||
* "command not implemented" or something.
|
* "command not implemented" or something.
|
||||||
*/
|
*/
|
||||||
if (command_data && *(uint32_t *)command_data) {
|
if (command_data && *(uint32_t *)command_data) {
|
||||||
|
switch (*(uint32_t *)command_data) {
|
||||||
|
case 1: iscsi_set_error(iscsi, "TASK MGMT responded Task Does Not Exist");
|
||||||
|
break;
|
||||||
|
case 2: iscsi_set_error(iscsi, "TASK MGMT responded LUN Does Not Exist");
|
||||||
|
break;
|
||||||
|
case 3: iscsi_set_error(iscsi, "TASK MGMT responded Task Still Allegiant");
|
||||||
|
break;
|
||||||
|
case 4: iscsi_set_error(iscsi, "TASK MGMT responded Task Allegiance Reassignment Not Supported");
|
||||||
|
break;
|
||||||
|
case 5: iscsi_set_error(iscsi, "TASK MGMT responded Task Mgmt Function Not Supported");
|
||||||
|
break;
|
||||||
|
case 6: iscsi_set_error(iscsi, "TASK MGMT responded Function Authorization Failed");
|
||||||
|
break;
|
||||||
|
case 255: iscsi_set_error(iscsi, "TASK MGMT responded Function Rejected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
state->status = SCSI_STATUS_ERROR;
|
state->status = SCSI_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ test_reserve6_lun_reset(void)
|
|||||||
logging(LOG_VERBOSE, "Send a LUN Reset");
|
logging(LOG_VERBOSE, "Send a LUN Reset");
|
||||||
ret = iscsi_task_mgmt_lun_reset_sync(iscsic, tgt_lun);
|
ret = iscsi_task_mgmt_lun_reset_sync(iscsic, tgt_lun);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
logging(LOG_NORMAL, "LUN reset failed");
|
logging(LOG_NORMAL, "LUN reset failed. %s", iscsi_get_error(iscsic));
|
||||||
}
|
}
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ test_reserve6_target_cold_reset(void)
|
|||||||
logging(LOG_VERBOSE, "Send a Cold Reset to the target");
|
logging(LOG_VERBOSE, "Send a Cold Reset to the target");
|
||||||
ret = iscsi_task_mgmt_target_cold_reset_sync(iscsic);
|
ret = iscsi_task_mgmt_target_cold_reset_sync(iscsic);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
logging(LOG_NORMAL, "Cold reset failed");
|
logging(LOG_NORMAL, "Cold reset failed. %s", iscsi_get_error(iscsic));
|
||||||
}
|
}
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ test_reserve6_target_warm_reset(void)
|
|||||||
logging(LOG_VERBOSE, "Send a Warm Reset to the target");
|
logging(LOG_VERBOSE, "Send a Warm Reset to the target");
|
||||||
ret = iscsi_task_mgmt_target_warm_reset_sync(iscsic);
|
ret = iscsi_task_mgmt_target_warm_reset_sync(iscsic);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
logging(LOG_NORMAL, "Warm reset failed");
|
logging(LOG_NORMAL, "Warm reset failed. %s", iscsi_get_error(iscsic));
|
||||||
}
|
}
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user