diff --git a/test-tool/iscsi-multipath.c b/test-tool/iscsi-multipath.c index 98c4838..d691ed3 100644 --- a/test-tool/iscsi-multipath.c +++ b/test-tool/iscsi-multipath.c @@ -369,3 +369,19 @@ mpath_check_matching_ids(int num_sds, ret = mpath_check_matching_ids_serial_vpd(num_sds, sds); return ret; } + +int +mpath_count_iscsi(int num_sds, + struct scsi_device **sds) +{ + int i; + int found = 0; + + for (i = 0; i < num_sds; i++) { + if (sds[i]->iscsi_ctx != NULL) { + found++; + } + } + + return found; +} diff --git a/test-tool/iscsi-multipath.h b/test-tool/iscsi-multipath.h index 5090503..2fcd6ea 100644 --- a/test-tool/iscsi-multipath.h +++ b/test-tool/iscsi-multipath.h @@ -24,6 +24,13 @@ extern int mp_num_sds; extern struct scsi_device *mp_sds[MPATH_MAX_DEVS]; +int +mpath_check_matching_ids(int num_sds, + struct scsi_device **sds); +int +mpath_count_iscsi(int num_sds, + struct scsi_device **sds); + #define MPATH_SKIP_IF_UNAVAILABLE(_sds, _num_sds) \ do { \ if (_num_sds <= 1) { \ @@ -35,8 +42,15 @@ do { \ } \ } while (0); -int -mpath_check_matching_ids(int num_sds, - struct scsi_device **sds); +#define MPATH_SKIP_UNLESS_ISCSI(_sds, _num_sds) \ +do { \ + if (mpath_count_iscsi(_num_sds, _sds) != _num_sds) { \ + logging(LOG_NORMAL, "[SKIPPED] Non-iSCSI multipath." \ + " Skipping test"); \ + CU_PASS("[SKIPPED] Non-iSCSI multipath." \ + " Skipping test"); \ + return; \ + } \ +} while (0); #endif /* _ISCSI_MULTIPATH_H_ */