From b1b3c603afc2b5ee95e212cd82f7c5f4e2b98b3a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 21 Jul 2013 09:20:00 -0700 Subject: [PATCH] TESTS: clear unit attention after changing SWP settings in the readonly test --- test-tool/iscsi-support.c | 5 ++++- test-tool/test_sanitize_readonly.c | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index d837fce..a9e4d29 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -1440,7 +1440,7 @@ int sanitize_writeprotected(struct iscsi_context *iscsi, int lun, int immed, int { struct scsi_task *task; - logging(LOG_VERBOSE, "Send SANITIZE (Expecting RESERVATION_CONFLICT) " + logging(LOG_VERBOSE, "Send SANITIZE (Expecting WRITE_PROTECTED) " "IMMED:%d AUSE:%d SA:%d " "PARAM_LEN:%d", immed, ause, sa, param_len); @@ -1588,8 +1588,11 @@ testunitready_clear_ua(struct iscsi_context *iscsi, int lun) logging(LOG_NORMAL, "[INFO] TESTUNITREADY command: failed with sense. %s", iscsi_get_error(iscsi)); + return -1; } scsi_free_scsi_task(task); + logging(LOG_VERBOSE, "[OK] TESTUNITREADY does not return unit " + "attention."); return 0; } diff --git a/test-tool/test_sanitize_readonly.c b/test-tool/test_sanitize_readonly.c index a486373..562f92c 100644 --- a/test-tool/test_sanitize_readonly.c +++ b/test-tool/test_sanitize_readonly.c @@ -53,6 +53,10 @@ test_sanitize_readonly(void) return; } + logging(LOG_VERBOSE, "Use TESTUNITREADY to clear unit attention on " + "first connection"); + while (testunitready_clear_ua(iscsic, tgt_lun)); + logging(LOG_VERBOSE, "Check if SANITIZE OVERWRITE is supported " "in REPORT_SUPPORTED_OPCODES"); cd = get_command_descriptor(SCSI_OPCODE_SANITIZE, @@ -109,6 +113,10 @@ test_sanitize_readonly(void) logging(LOG_VERBOSE, "Clear Software Write Protect on the second connection"); ret = clear_swp(iscsic2, tgt_lun); + logging(LOG_VERBOSE, "Use TESTUNITREADY to clear unit attention on " + "first connection"); + while (testunitready_clear_ua(iscsic, tgt_lun)); + iscsi_destroy_context(iscsic2); iscsic2 = NULL; }