diff --git a/test-tool/0104_read10_flags.c b/test-tool/0104_read10_flags.c index 5d04408..d4c75fb 100644 --- a/test-tool/0104_read10_flags.c +++ b/test-tool/0104_read10_flags.c @@ -26,6 +26,7 @@ int T0104_read10_flags(const char *initiator, const char *url, int data_loss _U_ { struct iscsi_context *iscsi; struct scsi_task *task; + struct scsi_inquiry_standard *inq; int ret, lun; printf("0104_read10_flags:\n"); @@ -50,6 +51,24 @@ int T0104_read10_flags(const char *initiator, const char *url, int data_loss _U_ ret = 0; + /* This test is only valid for SBC devices */ + task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64); + if (task == NULL || task->status != SCSI_STATUS_GOOD) { + printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi)); + return -1; + } + inq = scsi_datain_unmarshall(task); + if (inq == NULL) { + printf("failed to unmarshall inquiry datain blob\n"); + scsi_free_scsi_task(task); + return -1; + } + if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + printf("LUN is not SBC device. Skipping test\n"); + scsi_free_scsi_task(task); + return -1; + } + /* Try out DPO : 1 */ printf("Read10 with DPO==1 ... "); diff --git a/test-tool/0202_read16_flags.c b/test-tool/0202_read16_flags.c index f8fec8f..7f0f02c 100644 --- a/test-tool/0202_read16_flags.c +++ b/test-tool/0202_read16_flags.c @@ -25,6 +25,7 @@ int T0202_read16_flags(const char *initiator, const char *url, int data_loss _U_ struct iscsi_context *iscsi; struct scsi_task *task; struct scsi_readcapacity16 *rc16; + struct scsi_inquiry_standard *inq; int ret = 0, lun; uint32_t block_size; @@ -46,6 +47,24 @@ int T0202_read16_flags(const char *initiator, const char *url, int data_loss _U_ return -1; } + /* This test is only valid for SBC devices */ + task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64); + if (task == NULL || task->status != SCSI_STATUS_GOOD) { + printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi)); + return -1; + } + inq = scsi_datain_unmarshall(task); + if (inq == NULL) { + printf("failed to unmarshall inquiry datain blob\n"); + scsi_free_scsi_task(task); + return -1; + } + if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + printf("LUN is not SBC device. Skipping test\n"); + scsi_free_scsi_task(task); + return -1; + } + /* find the size of the LUN */ task = iscsi_readcapacity16_sync(iscsi, lun); if (task == NULL) { diff --git a/test-tool/0212_read12_flags.c b/test-tool/0212_read12_flags.c index 69cb39b..34d5a3d 100644 --- a/test-tool/0212_read12_flags.c +++ b/test-tool/0212_read12_flags.c @@ -25,6 +25,7 @@ int T0212_read12_flags(const char *initiator, const char *url, int data_loss _U_ struct iscsi_context *iscsi; struct scsi_task *task; struct scsi_readcapacity16 *rc16; + struct scsi_inquiry_standard *inq; int ret = 0, lun; uint32_t block_size; @@ -46,6 +47,24 @@ int T0212_read12_flags(const char *initiator, const char *url, int data_loss _U_ return -1; } + /* This test is only valid for SBC devices */ + task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64); + if (task == NULL || task->status != SCSI_STATUS_GOOD) { + printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi)); + return -1; + } + inq = scsi_datain_unmarshall(task); + if (inq == NULL) { + printf("failed to unmarshall inquiry datain blob\n"); + scsi_free_scsi_task(task); + return -1; + } + if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + printf("LUN is not SBC device. Skipping test\n"); + scsi_free_scsi_task(task); + return -1; + } + /* find the size of the LUN */ task = iscsi_readcapacity16_sync(iscsi, lun); if (task == NULL) { diff --git a/test-tool/0222_write16_flags.c b/test-tool/0222_write16_flags.c index b7ce77f..6b8d900 100644 --- a/test-tool/0222_write16_flags.c +++ b/test-tool/0222_write16_flags.c @@ -25,6 +25,7 @@ int T0222_write16_flags(const char *initiator, const char *url, int data_loss, i struct iscsi_context *iscsi; struct scsi_task *task; struct scsi_readcapacity16 *rc16; + struct scsi_inquiry_standard *inq; int ret = 0, lun; uint32_t block_size; unsigned char data[256 * 512]; @@ -47,6 +48,24 @@ int T0222_write16_flags(const char *initiator, const char *url, int data_loss, i return -1; } + /* This test is only valid for SBC devices */ + task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64); + if (task == NULL || task->status != SCSI_STATUS_GOOD) { + printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi)); + return -1; + } + inq = scsi_datain_unmarshall(task); + if (inq == NULL) { + printf("failed to unmarshall inquiry datain blob\n"); + scsi_free_scsi_task(task); + return -1; + } + if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + printf("LUN is not SBC device. Skipping test\n"); + scsi_free_scsi_task(task); + return -1; + } + /* find the size of the LUN */ task = iscsi_readcapacity16_sync(iscsi, lun); if (task == NULL) { diff --git a/test-tool/0232_write12_flags.c b/test-tool/0232_write12_flags.c index 4e19a2a..de7c037 100644 --- a/test-tool/0232_write12_flags.c +++ b/test-tool/0232_write12_flags.c @@ -25,6 +25,7 @@ int T0232_write12_flags(const char *initiator, const char *url, int data_loss, i struct iscsi_context *iscsi; struct scsi_task *task; struct scsi_readcapacity16 *rc16; + struct scsi_inquiry_standard *inq; int ret = 0, lun; uint32_t block_size; unsigned char data[256 * 512]; @@ -47,6 +48,24 @@ int T0232_write12_flags(const char *initiator, const char *url, int data_loss, i return -1; } + /* This test is only valid for SBC devices */ + task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64); + if (task == NULL || task->status != SCSI_STATUS_GOOD) { + printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi)); + return -1; + } + inq = scsi_datain_unmarshall(task); + if (inq == NULL) { + printf("failed to unmarshall inquiry datain blob\n"); + scsi_free_scsi_task(task); + return -1; + } + if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + printf("LUN is not SBC device. Skipping test\n"); + scsi_free_scsi_task(task); + return -1; + } + /* find the size of the LUN */ task = iscsi_readcapacity16_sync(iscsi, lun); if (task == NULL) { diff --git a/test-tool/0292_write10_flags.c b/test-tool/0292_write10_flags.c index 0a4102b..007f214 100644 --- a/test-tool/0292_write10_flags.c +++ b/test-tool/0292_write10_flags.c @@ -25,6 +25,7 @@ int T0292_write10_flags(const char *initiator, const char *url, int data_loss, i struct iscsi_context *iscsi; struct scsi_task *task; struct scsi_readcapacity16 *rc16; + struct scsi_inquiry_standard *inq; int ret = 0, lun; uint32_t block_size; unsigned char data[256 * 512]; @@ -47,6 +48,24 @@ int T0292_write10_flags(const char *initiator, const char *url, int data_loss, i return -1; } + /* This test is only valid for SBC devices */ + task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64); + if (task == NULL || task->status != SCSI_STATUS_GOOD) { + printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi)); + return -1; + } + inq = scsi_datain_unmarshall(task); + if (inq == NULL) { + printf("failed to unmarshall inquiry datain blob\n"); + scsi_free_scsi_task(task); + return -1; + } + if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + printf("LUN is not SBC device. Skipping test\n"); + scsi_free_scsi_task(task); + return -1; + } + /* find the size of the LUN */ task = iscsi_readcapacity16_sync(iscsi, lun); if (task == NULL) {