saltstack-formulas / iscsi-formula

Manage iSCSI Target and Initiator via SaltStack (FreeBSD & GNU/Linux)
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
8 stars 7 forks source link

Create more storage objects in onetime #19

Closed juadk closed 4 years ago

juadk commented 5 years ago

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?

noelmcloughlin commented 5 years ago

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.

juadk commented 5 years ago

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.

noelmcloughlin commented 5 years ago

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.

noelmcloughlin commented 4 years ago

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.

noelmcloughlin commented 4 years ago

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

saltstack-formulas-travis commented 4 years ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

noelmcloughlin commented 4 years ago

Hi @juadk See solution here: https://github.com/saltstack-formulas/iscsi-formula/blob/78c000dad1aa99de8dde92b439d57f2f0dae7b35/pillar.example#L203-L636

juadk commented 4 years ago

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