TESTS: Try reading the BlockDeviceCharacteristics VPD page on startup

This commit is contained in:
Ronnie Sahlberg
2013-05-26 19:53:27 -07:00
parent b193e08be8
commit 10d101cf51
3 changed files with 18 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ const char *tgt_url;
struct scsi_inquiry_standard *inq;
struct scsi_inquiry_logical_block_provisioning *inq_lbp;
struct scsi_inquiry_block_device_characteristics *inq_bdc;
struct scsi_inquiry_block_limits *inq_bl;
struct scsi_readcapacity16 *rc16;
struct scsi_report_supported_op_codes *rsop;

View File

@@ -141,6 +141,7 @@ do { \
extern struct scsi_inquiry_standard *inq;
extern struct scsi_inquiry_logical_block_provisioning *inq_lbp;
extern struct scsi_inquiry_block_device_characteristics *inq_bdc;
extern struct scsi_inquiry_block_limits *inq_bl;
extern struct scsi_readcapacity16 *rc16;
extern struct scsi_report_supported_op_codes *rsop;

View File

@@ -894,6 +894,7 @@ main(int argc, char *argv[])
struct scsi_readcapacity10 *rc10;
struct scsi_task *inq_task = NULL;
struct scsi_task *inq_lbp_task = NULL;
struct scsi_task *inq_bdc_task = NULL;
struct scsi_task *inq_bl_task = NULL;
struct scsi_task *rc16_task = NULL;
struct scsi_task *rsop_task = NULL;
@@ -1110,6 +1111,18 @@ main(int argc, char *argv[])
}
}
/* try reading block device characteristics vpd */
inq_bdc_task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS, 255);
if (inq_bdc_task == NULL) {
printf("Failed to read Block Device Characteristics page\n");
}
if (inq_bdc_task) {
inq_bdc = scsi_datain_unmarshall(inq_bdc_task);
if (inq_bdc == NULL) {
printf("failed to unmarshall inquiry datain blob\n");
return -1;
}
}
/* if thin provisioned we also need to read the VPD page for it */
if (rc16 && rc16->lbpme != 0){
@@ -1224,6 +1237,9 @@ main(int argc, char *argv[])
if (inq_lbp_task != NULL) {
scsi_free_scsi_task(inq_lbp_task);
}
if (inq_bdc_task != NULL) {
scsi_free_scsi_task(inq_bdc_task);
}
if (rc16_task != NULL) {
scsi_free_scsi_task(rc16_task);
}