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

iSNS and iSCSI for GNU/Linux and FreeBSD #2

Closed noelmcloughlin closed 6 years ago

noelmcloughlin commented 6 years ago

The original formula supports FreeBSD only. This PR extends support to iSNS/iSCSI implementations across various Linux. I think the code is good enough to merge - its heavily tested.

noelmcloughlin commented 6 years ago

Verified on Centos7 with pillars - WIP (Centos7_withPillars.txt

noelmcloughlin commented 6 years ago

Works on FreeBSD without pillars: FreeBSD_without_Pillars.txt

noelmcloughlin commented 6 years ago

PR works on OpenBSD with PillarsFreeBSD_with_Pillars_WIP.txt but I need to fix formatting in map5.jinja

noelmcloughlin commented 6 years ago

Fully verified on FreeBSD 11 with large pillars. Requires ctld_env="-u"' entry in /etc/rc.conf first.

noelmcloughlin commented 6 years ago

This has been verified on Centos, Ubuntu, FreeBSD, Archlinux, and Suse.

noelmcloughlin commented 6 years ago

Here is the saveconfig.json generated from pillar.example data on Archlinux, Centos, Suse, Debian. The ctl.conf on FreeBSD is similar too but UCL format (slight difference to JSON). The ISCSI target, initiator, and ISNS daemons are working on all Distro I tested.

@javierbertoli @aboe76 Could you merge this PR now please? Any issues and I'll fix in future PR.

{
        "fabric_modules": [
        {
            "discovery_enable_auth": "true",
            "discovery_mutual_password": "itsreallyme",
            "discovery_mutual_userid": "target",
            "discovery_password": "letmein",
            "discovery_userid": "initiator",
            "name": "iscsi"
        }
        ],

        "storage_objects": [
        {
            "attributes":
            {
                "block_size": 1024,
                "emulate_write_cache": 0,
                "max_sectors": 1024,
                "queue_depth": 128,
                "task_timeout": 0,
                "unmap_granularity": 0
            },

            "dev": "/dev/vg_storage/station4mp",
            "name": "mptarget4",
            "plugin": "block",
            "wwn": "6be30fb6-3bc9-43c4-a866-4d8633af5cf2"
        }
        ],

        "targets": [
        {
            "fabric": "iscsi",
            "tpgs": [
            {
                "attributes":
                {
                    "authentication": 1,
                    "cache_dynamic_acls": 0,
                    "default_cmdsn_depth": 16,
                    "demo_mode_write_protect": 1,
                    "generate_node_acls": 0,
                    "login_timeout": 15,
                    "netif_timeout": 2,
                    "prod_mode_write_protect": 0
                },

                "luns": [
                {
                    "index": 0,
                    "storage_object": "/backstores/block/mptarget4"
                }
                ],

                "node_acls": [
                {
                    "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": [
                    {
                        "index": 0,
                        "tpg_lun": 0,
                        "write_protect": "false"
                    }
                    ],

                    "node_wwn": "iqn.1994-05.com.redhat:station4",
                    "tcq_depth": 16
                }
                ],

                "portals": [
                {
                    "ip_address": "10.100.0.199",
                    "port": 3260
                }
                ],

                "tag": 1
            }
            ],

            "wwn": "iqn.2003-01.org.linux-iscsi.storage:mptarget4"
        }
        ]
}
aboe76 commented 6 years ago

@noelmcloughlin merged it.

noelmcloughlin commented 6 years ago

Thanks a million @aboe76

saltstack-formulas-travis commented 4 years ago

:tada: This PR is included in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: