From 7561086411949f84621a780aafcb849df506a056 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Wed, 21 Jun 2023 21:35:52 +0200 Subject: [PATCH] Add ISCSI test scripts Signed-off-by: Georg Pfuetzenreuter --- test/bootstrap-salt-roots.sh | 2 + test/configs/target.json | 338 +++++++++++++++++++++++++++++++++++ test/scripts/iscsi.sh | 20 +++ 3 files changed, 360 insertions(+) create mode 100644 test/configs/target.json create mode 100755 test/scripts/iscsi.sh diff --git a/test/bootstrap-salt-roots.sh b/test/bootstrap-salt-roots.sh index e54aa423..fdcfa706 100644 --- a/test/bootstrap-salt-roots.sh +++ b/test/bootstrap-salt-roots.sh @@ -79,3 +79,5 @@ if [ ! -d '/data' ] then mkdir '/data' fi +# to-do: somehow only run this if needed +/vagrant/test/scripts/iscsi.sh diff --git a/test/configs/target.json b/test/configs/target.json new file mode 100644 index 00000000..382a8199 --- /dev/null +++ b/test/configs/target.json @@ -0,0 +1,338 @@ +{ + "fabric_modules": [], + "storage_objects": [ + { + "aio": false, + "alua_tpgs": [ + { + "alua_access_state": 0, + "alua_access_status": 0, + "alua_access_type": 3, + "alua_support_active_nonoptimized": 1, + "alua_support_active_optimized": 1, + "alua_support_offline": 1, + "alua_support_standby": 1, + "alua_support_transitioning": 1, + "alua_support_unavailable": 1, + "alua_write_metadata": 0, + "implicit_trans_secs": 0, + "name": "default_tg_pt_gp", + "nonop_delay_msecs": 100, + "preferred": 0, + "tg_pt_gp_id": 0, + "trans_delay_msecs": 0 + } + ], + "attributes": { + "alua_support": 1, + "block_size": 512, + "emulate_3pc": 1, + "emulate_caw": 1, + "emulate_dpo": 1, + "emulate_fua_read": 1, + "emulate_fua_write": 1, + "emulate_model_alias": 1, + "emulate_pr": 1, + "emulate_rest_reord": 0, + "emulate_tas": 1, + "emulate_tpu": 0, + "emulate_tpws": 0, + "emulate_ua_intlck_ctrl": 0, + "emulate_write_cache": 1, + "enforce_pr_isids": 1, + "force_pr_aptpl": 0, + "is_nonrot": 0, + "max_unmap_block_desc_count": 1, + "max_unmap_lba_count": 8192, + "max_write_same_len": 4096, + "optimal_sectors": 16384, + "pgr_support": 1, + "pi_prot_format": 0, + "pi_prot_type": 0, + "pi_prot_verify": 0, + "queue_depth": 128, + "unmap_granularity": 1, + "unmap_granularity_alignment": 0, + "unmap_zeroes_data": 0 + }, + "dev": "/data/lun/3", + "name": "lun3", + "plugin": "fileio", + "size": 5242880, + "write_back": true, + "wwn": "52d6bc1c-2125-43e5-8c77-46696234bb16" + }, + { + "aio": false, + "alua_tpgs": [ + { + "alua_access_state": 0, + "alua_access_status": 0, + "alua_access_type": 3, + "alua_support_active_nonoptimized": 1, + "alua_support_active_optimized": 1, + "alua_support_offline": 1, + "alua_support_standby": 1, + "alua_support_transitioning": 1, + "alua_support_unavailable": 1, + "alua_write_metadata": 0, + "implicit_trans_secs": 0, + "name": "default_tg_pt_gp", + "nonop_delay_msecs": 100, + "preferred": 0, + "tg_pt_gp_id": 0, + "trans_delay_msecs": 0 + } + ], + "attributes": { + "alua_support": 1, + "block_size": 512, + "emulate_3pc": 1, + "emulate_caw": 1, + "emulate_dpo": 1, + "emulate_fua_read": 1, + "emulate_fua_write": 1, + "emulate_model_alias": 1, + "emulate_pr": 1, + "emulate_rest_reord": 0, + "emulate_tas": 1, + "emulate_tpu": 0, + "emulate_tpws": 0, + "emulate_ua_intlck_ctrl": 0, + "emulate_write_cache": 1, + "enforce_pr_isids": 1, + "force_pr_aptpl": 0, + "is_nonrot": 0, + "max_unmap_block_desc_count": 1, + "max_unmap_lba_count": 8192, + "max_write_same_len": 4096, + "optimal_sectors": 16384, + "pgr_support": 1, + "pi_prot_format": 0, + "pi_prot_type": 0, + "pi_prot_verify": 0, + "queue_depth": 128, + "unmap_granularity": 1, + "unmap_granularity_alignment": 0, + "unmap_zeroes_data": 0 + }, + "dev": "/data/lun/2", + "name": "lun2", + "plugin": "fileio", + "size": 5242880, + "write_back": true, + "wwn": "fc999be3-79b3-46d3-9a43-5f59bcaeffbf" + }, + { + "aio": false, + "alua_tpgs": [ + { + "alua_access_state": 0, + "alua_access_status": 0, + "alua_access_type": 3, + "alua_support_active_nonoptimized": 1, + "alua_support_active_optimized": 1, + "alua_support_offline": 1, + "alua_support_standby": 1, + "alua_support_transitioning": 1, + "alua_support_unavailable": 1, + "alua_write_metadata": 0, + "implicit_trans_secs": 0, + "name": "default_tg_pt_gp", + "nonop_delay_msecs": 100, + "preferred": 0, + "tg_pt_gp_id": 0, + "trans_delay_msecs": 0 + } + ], + "attributes": { + "alua_support": 1, + "block_size": 512, + "emulate_3pc": 1, + "emulate_caw": 1, + "emulate_dpo": 1, + "emulate_fua_read": 1, + "emulate_fua_write": 1, + "emulate_model_alias": 1, + "emulate_pr": 1, + "emulate_rest_reord": 0, + "emulate_tas": 1, + "emulate_tpu": 0, + "emulate_tpws": 0, + "emulate_ua_intlck_ctrl": 0, + "emulate_write_cache": 1, + "enforce_pr_isids": 1, + "force_pr_aptpl": 0, + "is_nonrot": 0, + "max_unmap_block_desc_count": 1, + "max_unmap_lba_count": 8192, + "max_write_same_len": 4096, + "optimal_sectors": 16384, + "pgr_support": 1, + "pi_prot_format": 0, + "pi_prot_type": 0, + "pi_prot_verify": 0, + "queue_depth": 128, + "unmap_granularity": 1, + "unmap_granularity_alignment": 0, + "unmap_zeroes_data": 0 + }, + "dev": "/data/lun/1", + "name": "lun1", + "plugin": "fileio", + "size": 5242880, + "write_back": true, + "wwn": "dc2ebb3f-6d0d-4f9a-8931-14e6fd07b301" + } + ], + "targets": [ + { + "fabric": "iscsi", + "parameters": { + "cmd_completion_affinity": "-1" + }, + "tpgs": [ + { + "attributes": { + "authentication": 0, + "cache_dynamic_acls": 0, + "default_cmdsn_depth": 64, + "default_erl": 0, + "demo_mode_discovery": 1, + "demo_mode_write_protect": 1, + "fabric_prot_type": 0, + "generate_node_acls": 0, + "login_keys_workaround": 1, + "login_timeout": 15, + "netif_timeout": 2, + "prod_mode_write_protect": 0, + "t10_pi": 0, + "tpg_enabled_sendtargets": 1 + }, + "enable": true, + "luns": [ + { + "alias": "68edd2aeea", + "alua_tg_pt_gp_name": "default_tg_pt_gp", + "index": 3, + "storage_object": "/backstores/fileio/lun3" + }, + { + "alias": "b0954e03c0", + "alua_tg_pt_gp_name": "default_tg_pt_gp", + "index": 2, + "storage_object": "/backstores/fileio/lun2" + }, + { + "alias": "c34d05fb85", + "alua_tg_pt_gp_name": "default_tg_pt_gp", + "index": 1, + "storage_object": "/backstores/fileio/lun1" + } + ], + "node_acls": [ + { + "attributes": { + "dataout_timeout": 3, + "dataout_timeout_retries": 5, + "default_erl": 0, + "nopin_response_timeout": 30, + "nopin_timeout": 15, + "random_datain_pdu_offsets": 0, + "random_datain_seq_offsets": 0, + "random_r2t_offsets": 0 + }, + "mapped_luns": [ + { + "alias": "069f97d471", + "index": 3, + "tpg_lun": 3, + "write_protect": false + }, + { + "alias": "d023dbb417", + "index": 2, + "tpg_lun": 2, + "write_protect": false + }, + { + "alias": "07e2d50cc2", + "index": 1, + "tpg_lun": 1, + "write_protect": false + } + ], + "node_wwn": "iqn.1996-04.de.suse:01:a7111c224918" + }, + { + "attributes": { + "dataout_timeout": 3, + "dataout_timeout_retries": 5, + "default_erl": 0, + "nopin_response_timeout": 30, + "nopin_timeout": 15, + "random_datain_pdu_offsets": 0, + "random_datain_seq_offsets": 0, + "random_r2t_offsets": 0 + }, + "mapped_luns": [ + { + "alias": "2956bbaf71", + "index": 3, + "tpg_lun": 3, + "write_protect": false + }, + { + "alias": "e5ffb173ee", + "index": 2, + "tpg_lun": 2, + "write_protect": false + }, + { + "alias": "3bece256a5", + "index": 1, + "tpg_lun": 1, + "write_protect": false + } + ], + "node_wwn": "iqn.1996-04.de.suse:01:14cf5d2c1f84" + } + ], + "parameters": { + "AuthMethod": "CHAP,None", + "DataDigest": "CRC32C,None", + "DataPDUInOrder": "Yes", + "DataSequenceInOrder": "Yes", + "DefaultTime2Retain": "20", + "DefaultTime2Wait": "2", + "ErrorRecoveryLevel": "0", + "FirstBurstLength": "65536", + "HeaderDigest": "CRC32C,None", + "IFMarkInt": "Reject", + "IFMarker": "No", + "ImmediateData": "Yes", + "InitialR2T": "Yes", + "MaxBurstLength": "262144", + "MaxConnections": "1", + "MaxOutstandingR2T": "1", + "MaxRecvDataSegmentLength": "8192", + "MaxXmitDataSegmentLength": "262144", + "OFMarkInt": "Reject", + "OFMarker": "No", + "TargetAlias": "LIO Target" + }, + "portals": [ + { + "ip_address": "0.0.0.0", + "iser": false, + "offload": false, + "port": 3260 + } + ], + "tag": 1 + } + ], + "wwn": "iqn.2003-01.org.linux-iscsi.scullery-master0.x8664:sn.5034edf18f27" + } + ] +} diff --git a/test/scripts/iscsi.sh b/test/scripts/iscsi.sh new file mode 100755 index 00000000..f01f81bf --- /dev/null +++ b/test/scripts/iscsi.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -Ceux +if test -f /var/adm/iscsi.configured ; then exit ; fi +echo 'iqn.1996-04.de.suse:01:3d33457f6212' >| /etc/iscsi/initiatorname.iscsi +targetctl restore /vagrant/test/configs/target.json +mkdir /data/lun +targetcli <