Top
PRIMECLUSTER Global Disk Services  Configuration and AdministrationGuide 4.6
FUJITSU Software

4.8.3 Creating iSCSI Target

Set the following configuration for all nodes in which the mirroring function among servers is used.

The "current node" in the following procedure indicates: node 1 if you execute the procedure on the node 1; node 2 if you execute the procedure on the node 2.

  1. Execute targetcli to be an interactive mode.

    # targetcli
  2. Set not to add a default portal automatically.

    /> set global auto_add_default_portal=false
  3. Register a disk or a partition of a local node for the mirroring among servers.

    /> /backstores/block/ create storage_name device_path

    Point

    • Specify arbitrary characters (255 characters or less) to storage_name.

    • For device_path, specify the path for the by-id file of a disk or a partition on a local node which is used for the mirroring among servers.
      In an Azure environment, a NIFCLOUD environment, or an environment where the by-id file does not exist, do not specify the path for the by-id file, but create a partition in the disk where the gpt disk label is set, and specify the path for the by-partuuid file for that partition.

    • If there are plural disks for the mirroring among servers on a local node, perform the procedure for each disk.

    Execution example

    /> /backstores/block/ create storage1 /dev/disk/by-id/scsi-3500000e111c56611
  4. Check the setting of device.

    Execute the following command to check that emulate_write_cache is 0.

    /> /backstores/block/storage_name get attribute emulate_write_cache

    Point

    Specify the storage name set in the step 3 to storage_name.

    Execution example

    /> /backstores/block/storage1 get attribute emulate_write_cache
    emulate_write_cache=0
  5. Create iSCSI target.

    /> /iscsi/ create
  6. Check the created iSCSI target.

    /> /iscsi/ ls

    Execution example

    /> /iscsi/ ls
    o- iscsi ..................................................................... [Targets: 1]
      o- iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98 .................... [TPGs: 1]
        o- tpg1 ........................................................ [no-gen-acls, no-auth]
          o- acls ................................................................... [ACLs: 0]
          o- luns ................................................................... [LUNs: 0]
          o- portals ............................................................. [Portals: 0]

    This example shows that iqn name "iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98" was created and the target was created in /iscsi/.

  7. Register iSCSI initiators of both nodes.

    /> /iscsi/iqn_name/tpgX/acls create initiator_name_of_node1
    /> /iscsi/iqn_name/tpgX/acls create initiator_name_of_node2

    Point

    • Specify the iqn name confirmed in the step 6 to iqn_name.

    • Specify the directory name (Example: tpg1) created in the iqn_name directory to tpgX.

    • Initiator name can be confirmed in the /etc/iscsi/initiatorname.iscsi file.

    Execution example

    /> /iscsi/iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98/tpg1/acls create \
    iqn.1994-05.com.redhat:dee92ff9979d
    /> /iscsi/iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98/tpg1/acls create  \
    iqn.1994-05.com.redhat:fa7eb9cf483c

    Note

    An iSCSI initiator name needs to be differed in each node of the cluster system.

    If an iSCSI initiator name in each node is identical, change it to a different iSCSI initiator name in each node.

    See the following procedure to change an iSCSI initiator name.

    1. Determine a new iSCSI initiator name.
      Use the following command to create an initiator name with random ID.

      (Example)

      # iscsi-iname
      iqn.1994-05.com.redhat:5ea612eab618
    2. Change a configuration file.
      In the /etc/iscsi/initiatorname.iscsi file, rewrite a character string following "InitiatorName=" to the iSCSI initiator name of the step 1.

      (Example)

      [Before change]

      InitiatorName=iqn.1994-05.com.redhat:4539cd846026

      [After change]

      InitiatorName=iqn.1994-05.com.redhat:5ea612eab618
    3. Restart iscsid to update the configuration.

      (Example)

      # systemctl restart iscsid.service
  8. Connect the device registered in the step 3.

    /> /iscsi/iqn_name/tpgX/luns create /backstores/block/storage_name

    Point

    • Specify iqn name confirmed in the step 6 to iqn_name.

    • Specify the directory name (Example: tpg1) created in the iqn_name directory to tpgX.

    • Specify the storage name set in the step 3 to storage_name.

    • If there are plural disks for the mirroring among servers on a local node, perform the procedure for each disk.

    Execution example

    /> /iscsi/iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98/tpg1/luns create \
    /backstores/block/storage1
  9. Register IP address for the target.

    /> /iscsi/iqn_name/tpgX/portals create IPaddress

    Point

    • Specify the iqn name confirmed in the step 6 to iqn_name.

    • Specify the directory name (Example: tpg1) created in the iqn_name directory to tpgX.

    • Specify IP address for the mirroring among servers on a local node to IPaddress.
      IPv4 address or IPv6 address can be set.
      IP address of cip can not be specified. Use IP address assigned NIC (such as eth0) directly.
      For conditions for NIC and IP address, refer to "3.9.1 Network Configuration."

    Execution example

    /> /iscsi/iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98/tpg1/portals create \
    192.168.125.123
  10. End the interactive mode of targetcli. This operation records the settings.

    /> exit
  11. Confirm the target configuration.

    # targetcli ls

    Point

    (*1) Confirm that the path for the by-id file of the device used for the mirroring among servers was output.
    If the by-partuuid file is specified in an Azure environment, a NIFCLOUD environment, or an environment where the by-id file does not exist, confirm that the path for the by-partuuid file is output.

    (*2) Confirm that iSCSI initiator name for each cluster node was output.

    (*3) Confirm that the storage confirmed in (*1) was assigned for each iSCSI initiator.

    (*4) Confirm that IP address of a local node for the mirroring among servers was output.

    Execution example

    # targetcli ls
    o- / .............................................................................. [...]
      o- backstores ................................................................... [...]
      | o- block ....................................................... [Storage Objects: 1]
      | | o- storage1 . [/dev/disk/by-id/scsi-3500000e111c56611 (8.0GiB) write-thru activated] (*1)
      | o- fileio ...................................................... [Storage Objects: 0]
      | o- pscsi ....................................................... [Storage Objects: 0]
      | o- ramdisk ..................................................... [Storage Objects: 0]
      o- iscsi ................................................................. [Targets: 1]
      | o- iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98 ................ [TPGs: 1]
      |   o- tpg1 .................................................... [no-gen-acls, no-auth]
      |     o- acls ............................................................... [ACLs: 2]
      |     | o- iqn.1994-05.com.redhat:dee92ff9979d ........................ [Mapped LUNs: 1] (*2)
      |     | | o- mapped_lun0 .................................... [lun0 block/storage1 (rw)] (*3)
      |     | o- iqn.1994-05.com.redhat:fa7eb9cf483c ........................ [Mapped LUNs: 1] (*2)
      |     |   o- mapped_lun0 .................................... [lun0 block/storage1 (rw)] (*3)
      |     o- luns ............................................................... [LUNs: 1]
      |     | o- lun0 ............. [block/storage1 (/dev/disk/by-id/scsi-3500000e111c56611)]
      |     o- portals ......................................................... [Portals: 1]
      |       o- 192.168.125.123:3260 ................................................... [OK] (*4)
      o- loopback .............................................................. [Targets: 0]