TESTS: Add a test that SANITIZE commands fail when there is a RESERVATION

This commit is contained in:
Ronnie Sahlberg
2013-07-09 01:51:00 -07:00
parent 9e9ca71247
commit 6e5a5745aa
10 changed files with 148 additions and 4 deletions

View File

@@ -1401,6 +1401,33 @@ int sanitize_invalidfieldincdb(struct iscsi_context *iscsi, int lun, int immed,
return 0;
}
int sanitize_conflict(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send SANITIZE (Expecting RESERVATION_CONFLICT) "
"IMMED:%d AUSE:%d SA:%d "
"PARAM_LEN:%d",
immed, ause, sa, param_len);
task = iscsi_sanitize_sync(iscsi, lun, immed, ause, sa, param_len,
data);
if (task == NULL) {
logging(LOG_NORMAL,
"[FAILED] Failed to send SANITIZE command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status != SCSI_STATUS_RESERVATION_CONFLICT) {
logging(LOG_NORMAL, "[FAILED] Expected RESERVATION CONFLICT");
return -1;
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] SANITIZE returned RESERVATION_CONFLICT.");
return 0;
}
int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start)
{
struct scsi_task *task;