Skip to content

Commit

Permalink
Add ISCSI test scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Pfuetzenreuter <[email protected]>
  • Loading branch information
tacerus committed Jun 21, 2023
1 parent 14ab899 commit 7561086
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/bootstrap-salt-roots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ if [ ! -d '/data' ]
then
mkdir '/data'
fi
# to-do: somehow only run this if needed
/vagrant/test/scripts/iscsi.sh
338 changes: 338 additions & 0 deletions test/configs/target.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
20 changes: 20 additions & 0 deletions test/scripts/iscsi.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOS
cd /backstores/fileio
create size=5M name=data1 file_or_dev=/data/lun/1
create size=5M name=data2 file_or_dev=/data/lun/2
create size=5M name=data3 file_or_dev=/data/lun/3
cd /iscsi/iqn.2003-01.org.linux-iscsi.scullery-master0.x8664:sn.5034edf18f27/tpg1/luns
create lun=1 storage_object=/backstores/fileio/data1
create lun=2 storage_object=/backstores/fileio/data2
create lun=3 storage_object=/backstores/fileio/data3
cd /
exit
EOS
touch /var/adm/iscsi.configured
systemctl enable --now target

0 comments on commit 7561086

Please sign in to comment.