saltstack-formulas / iscsi-formula

Manage iSCSI Target and Initiator via SaltStack (FreeBSD & GNU/Linux)

Home Page:http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create more storage objects in onetime

juadk opened this issue ยท comments

Hi, I wonder if there is a proper way to create more storage_objects in onetime.
I tried some solutions but all failed, I have this pillar file:

iscsi:
  isns:
    enabled: false
  target:
    lio:
      myconf:
        fabric_modules:
          authenticate_target: 'false'
          enforce_discovery_auth: 'false'
          name: "iscsi"
        storage_objects:
          attributes:
            block_size: 512
            emulate_write_cache: 0
            queue_depth: 64
            unmap_granularity: 0
          dev: "/dev/xvdd1"
          name: "sda"
          plugin: "block"
        targets:
          fabric: iscsi
          tpgs:
            attributes:
              authentication: 0
              cache_dynamic_acls: 0
              default_cmdsn_depth: 16
              demo_mode_write_protect: 0
              generate_node_acls: 1
              login_timeout: 15
              netif_timeout: 2
              prod_mode_write_protect: 0
            luns:
              index: 0
              storage_object: "/backstores/block/sda"
            portals:
              ip_address: xxxxxxxxx
              port: 3260
            tag: 1
          wwn: "iqn.1996-04.blabla:01:a66aed20e2f3"

I would like to add /dev/xvdd2 ==> sdb ==> lun1 and so one.
Maybe I'm missing something here, do you have an idea?

commented

Hi @juadk
My apologies for not seeing this issue until now. Sorry.

The man page has good advice:

EXAMPLE CONFIGURATION
Since tools generate this file, one good way to understand its format is to use a tool like targetcli to configure a target, then run saveconfig, and view the resulting json file.

Could you share what a manually generated saveconfig.json file looks like with multiple targets? I tried to find some examples on the web without luck. This would be helpful to me.

Hi @noelmcloughlin,
No worries for the delay.
The file below is a configuration file for 5 devices (/dev/xvdd1 to /dev/xvdd5).
saveconfig.txt
As a workaround, I'm using a static saveconfig.json file for my project but this is not modular.

commented

Hi @juadk
The jinja macros need improvement. I'll make some free time later in May (too busy now) and introduce support for multiple luns and storage_objects.

commented

Hello @juadk
Apologies for delay - I have a PR open to add this feature now. The pillar.example includes the required YAML to generate this JSON file: saveconfig.json.txt which includes multiple targets/luns.

commented

Fixed in #23
Should be merged shortly.
You need to update your pillar data to get multiple targets/luns support.

๐ŸŽ‰ This issue has been resolved in version 1.0.0 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

commented

Hi @juadk
See solution here:

fabric_modules:
callmewhateveryoulike0:
discovery_enable_auth: 'true'
discovery_mutual_password: itsreallyme
discovery_mutual_userid: target
discovery_password: letmein
discovery_userid: initiator
name: iscsi
callmewhateveryoulike1:
discovery_enable_auth: 'true'
discovery_mutual_password: itsreallysticky
storage_objects:
callmewhateveryoulike_sda:
alua_tpgs:
callemewhateveryoulike0:
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
callemewhateveryoulike1:
alua_access_state: 1
alua_support_active_nonoptimized: 1
attributes:
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: 0
enforce_pr_isids: 1
force_pr_aptpl: 0
is_nonrot: 1
max_unmap_block_desc_count: 0
max_unmap_lba_count: 0
max_write_same_len: 65535
optimal_sectors: 256
pi_prot_format: 0
pi_prot_type: 0
pi_prot_verify: 0
queue_depth: 64
unmap_granularity: 0
unmap_granularity_alignment: 0
unmap_zeroes_data: 0
dev: /dev/vxdd0
name: sda
plugin: 'block'
readonly: 'false'
write_back: 'false'
wwn: '9e8d8049-3538-41cb-94e6-6dbd2f1cf090'
callmewhateveryoulike_sdb:
alua_tpgs:
callemewhateveryoulike0:
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
callemewhateveryoulike1:
alua_access_state: 1
alua_support_active_nonoptimized: 1
attributes:
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: 0
enforce_pr_isids: 1
force_pr_aptpl: 0
is_nonrot: 1
max_unmap_block_desc_count: 0
max_unmap_lba_count: 0
max_write_same_len: 65535
optimal_sectors: 256
pi_prot_format: 0
pi_prot_type: 0
pi_prot_verify: 0
queue_depth: 64
unmap_granularity: 0
unmap_granularity_alignment: 0
unmap_zeroes_data: 0
dev: /dev/vxdd1
name: sdb
plugin: 'block'
readonly: 'false'
write_back: 'false'
wwn: '9e8d8049-3538-41cb-94e6-6dbd2f1cf091'
callmewhateveryoulike_sdc:
alua_tpgs:
callemewhateveryoulike0:
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
callemewhateveryoulike1:
alua_access_state: 1
alua_support_active_nonoptimized: 1
attributes:
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: 0
enforce_pr_isids: 1
force_pr_aptpl: 0
is_nonrot: 1
max_unmap_block_desc_count: 0
max_unmap_lba_count: 0
max_write_same_len: 65535
optimal_sectors: 256
pi_prot_format: 0
pi_prot_type: 0
pi_prot_verify: 0
queue_depth: 64
unmap_granularity: 0
unmap_granularity_alignment: 0
unmap_zeroes_data: 0
dev: /dev/vxdd2
name: sdc
plugin: 'block'
readonly: 'false'
write_back: 'false'
wwn: '9e8d8049-3538-41cb-94e6-6dbd2f1cf092'
callmewhateveryoulike_sdd:
alua_tpgs:
callemewhateveryoulike0:
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
callemewhateveryoulike1:
alua_access_state: 1
alua_support_active_nonoptimized: 1
attributes:
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: 0
enforce_pr_isids: 1
force_pr_aptpl: 0
is_nonrot: 1
max_unmap_block_desc_count: 0
max_unmap_lba_count: 0
max_write_same_len: 65535
optimal_sectors: 256
pi_prot_format: 0
pi_prot_type: 0
pi_prot_verify: 0
queue_depth: 64
unmap_granularity: 0
unmap_granularity_alignment: 0
unmap_zeroes_data: 0
dev: /dev/vxdd3
name: sdd
plugin: 'block'
readonly: 'false'
write_back: 'false'
wwn: '9e8d8049-3538-41cb-94e6-6dbd2f1cf093'
callmewhateveryoulike_sde:
alua_tpgs:
callemewhateveryoulike0:
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
callemewhateveryoulike1:
alua_access_state: 1
alua_support_active_nonoptimized: 1
attributes:
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: 0
enforce_pr_isids: 1
force_pr_aptpl: 0
is_nonrot: 1
max_unmap_block_desc_count: 0
max_unmap_lba_count: 0
max_write_same_len: 65535
optimal_sectors: 256
pi_prot_format: 0
pi_prot_type: 0
pi_prot_verify: 0
queue_depth: 64
unmap_granularity: 0
unmap_granularity_alignment: 0
unmap_zeroes_data: 0
dev: /dev/vxdd4
name: sde
plugin: 'block'
readonly: 'false'
write_back: 'false'
wwn: '9e8d8049-3538-41cb-94e6-6dbd2f1cf094'
targets:
canada:
fabric: iscsi
tpgs:
attributes:
authentication: 0
cache_dynamic_acls: 1
default_cmdsn_depth: 16
default_erl: 0
demo_mode_discovery: 1
demo_mode_write_protect: 0
fabric_prot_type: 0
generate_node_acls: 1
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:
callmewhateveryoulike0:
alias: 'd6b1e8e70a'
alua_tg_pt_gp_name: default_tg_pt_gp
index: 0
storage_object: /backstores/block/sda
callmewhateveryoulike1:
alias: 'd6b1e8e70b'
alua_tg_pt_gp_name: default_tg_pt_gp
index: 1
storage_object: /backstores/block/sdb
callmewhateveryoulike2:
alias: 'd6b1e8e70c'
alua_tg_pt_gp_name: default_tg_pt_gp
index: 2
storage_object: /backstores/block/sdc
callmewhateveryoulike3:
alias: 'd6b1e8e70d'
alua_tg_pt_gp_name: default_tg_pt_gp
index: 3
storage_object: /backstores/block/sdd
callmewhateveryoulike4:
alias: 'd6b1e8e70e'
alua_tg_pt_gp_name: default_tg_pt_gp
index: 4
storage_object: /backstores/block/sde
node_acls:
callmewhateveryoulike0:
attributes:
dataout_timeout: 3
dataout_timeout_retries: 5
default_erl: 0
nopin_response_timeout: 5
nopin_timeout: 5
random_datain_pdu_offsets: 0
random_datain_seq_offsets: 0
random_r2t_offsets: 0
chap_mutual_password: itsreallyme
chap_mutual_userid: target
chap_password: letmein
chap_userid: station4
mapped_luns:
mappy0:
index: 0
tpg_lun: 0
write_protect: 0
mappy1:
index: 1
tpg_lun: 1
write_protect: 0
mappy2:
index: 2
tpg_lun: 2
write_protect: 0
mappy3:
index: 3
tpg_lun: 3
write_protect: 0
mappy4:
index: 4
tpg_lun: 4
write_protect: 0
node_wwn: 'iqn.1994-05.com.redhat:station4'
tcq_depth: 16
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'
luxembourg:
fabric: iscsi
tpgs:
attributes:
authentication: 0
enable: 1
luns:
callmewhateveryoulike0:
alias: 'd6b1e8e70a'
index: 0
storage_object: /backstores/block/sda
callmewhateveryoulike1:
alias: 'd6b1e8e70b'
index: 1
storage_object: /backstores/block/sdb
callmewhateveryoulike2:
alias: 'd6b1e8e70c'
index: 2
storage_object: /backstores/block/sdc
callmewhateveryoulike3:
alias: 'd6b1e8e70d'
index: 3
storage_object: /backstores/block/sdd
callmewhateveryoulike4:
alias: 'd6b1e8e70e'
index: 4
storage_object: /backstores/block/sde
node_acls:
callmewhateveryoulike0:
attributes:
dataout_timeout: 3
parameters:
TargetAlias: LIO Target
portals:
callmewhateveryoulike0:
ip_address: 10.0.2.254
iser: 0
tag: 2
wwn: iqn.1996-04.lx.suse:01:a66aed20e2f3

Hi @noelmcloughlin , Thanks!
I will give a try asap!