iscsi-test: do not test DPO/FUA for non-SBC devices

These bits are not defined in MMC.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2012-08-30 16:59:35 +02:00
parent 560241b494
commit 418058e52a
6 changed files with 114 additions and 0 deletions

View File

@@ -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 ... ");

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {