TESTS: Add some REPORT SUPPORTED OPCODES tests

Add a simple test that it works or is not implemented.

Add a RCTD test to verify that with this flag clear we get command descriptors without CTDP set  and with it set we get command descriptors with CTDP set and a timeout descriptor
This commit is contained in:
Ronnie Sahlberg
2013-05-18 13:56:02 -07:00
parent ce4623b2fb
commit 709410b1d7
10 changed files with 286 additions and 76 deletions

View File

@@ -2759,6 +2759,48 @@ release6(struct iscsi_context *iscsi, int lun)
return 0;
}
int report_supported_opcodes(struct iscsi_context *iscsi, int lun, int rctd, int options, int opcode, int sa, int alloc_len, struct scsi_task **save_task)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send REPORT_SUPPORTED_OPCODE RCTD:%d OPTIONS:%d "
"OPCODE:%d SA:%d ALLOC_LEN:%d",
rctd, options, opcode, sa, alloc_len);
task = iscsi_report_supported_opcodes_sync(iscsi, lun,
rctd, options, opcode, sa, alloc_len);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send "
"REPORT_SUPPORTED_OPCODES command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
logging(LOG_NORMAL, "[SKIPPED] REPORT_SUPPORTED_OPCODES is not "
"implemented on target");
scsi_free_scsi_task(task);
return -2;
}
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] REPORT_SUPPORTED_OPCODES "
"command: failed with sense. %s",
iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (save_task != NULL) {
*save_task = task;
} else {
scsi_free_scsi_task(task);
}
logging(LOG_VERBOSE, "[OK] REPORT_SUPPORTED_OPCODES returned SUCCESS.");
return 0;
}
int
reserve6(struct iscsi_context *iscsi, int lun)
{