7.3. Managing Target Groups

This section explains how to create and manage groups of iSCSI targets.

7.3.1. Creating Target Groups

Before you create any target groups, assign the network with the iSCSI traffic type to a network interface on each node that you will add to a target group.

To create a target group, you will need a configuration file with a list of nodes to add to the group as well as target WWNs and portals. For example:

[
  {
    "NodeId": "01baeabee73e4a0d",
    "WWN": "iqn.2013-10.com.vstorage:test1",
    "Portals": [
      {
        "Addr": "192.168.10.11",
        "Port": 3025
      }
    ]
  },
  {
    "NodeId": "0d90158e9d2444e1",
    "WWN": "iqn.2013-10.com.vstorage:test2",
    "Portals": [
      {
        "Addr": "192.168.10.12",
        "Port": 3025
      }
    ]
  },
  {
    "NodeId": "a9eca47661a64031",
    "WWN": "iqn.2013-10.com.vstorage:test3",
    "Portals": [
      {
        "Addr": "192.168.10.13",
        "Port": 3025
      }
    ]
  }
]

In this configuration file:

  • NodeId is a node identifier that you can obtain from /etc/vstorage/host_id on a node.
  • WWN is a target world wide name:
    • an IQN if iSCSI protocol is used, e.g., iqn.2013-10.com.vstorage:test1 (you can only customize the last part after the colon), or
    • a WWPN in NAA format if Fibre Channel protocol is used, e.g., naa.21000024ff586d3b (you can obtain the port number from /sys/class/fc_host/host6/port_name).
  • Portals is one or more target portals, IP address and port combinations that the target will be accessible at. The IP address Addr belongs to a public network interface on the node that handles the iSCSI traffic type. The port Port is optional and defaults to 3260 if omitted.

Once you have the configuration file, e.g., tg1.json, you can create the target group with the vstorage-target tg-create command. For example, to create an iSCSI target group, run:

# vstorage-target tg-create -name tg1 -targets tg1.json -type ISCSI
{
  "Id": "3d8364f5-b830-4211-85af-3a19d30ebac4"
}

When you run the command, targets are created on the nodes specified in the configuration file and joined to the target group, target portals are created on the specified network interfaces and ports.

7.3.2. Starting and Stopping Target Groups

When you create a target group, its targets are initially stopped. You can start them with the vstorage-target tg-start command. For example:

# vstorage-target tg-start -id 3d8364f5-b830-4211-85af-3a19d30ebac4

This command starts all targets in the group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4.

All targets in a group can either be running or stopped. So if you add targets to a group of running targets, the new targets will be started automatically.

To stop a target group, use the vstorage-target tg-stop command. For example:

# vstorage-target tg-stop -id 3d8364f5-b830-4211-85af-3a19d30ebac4

7.3.3. Listing Target Groups

You can list target groups with the vstorage-target tg-list command that displays basic information about groups. For example:

# vstorage-target tg-list
[
  {
    "Id": "3d8364f5-b830-4211-85af-3a19d30ebac4",
    "Name": "tg1",
    "Type": "ISCSI",
    "Running": true,
    "ACL": false,
    "ChapAuth": false,
    "CHAP": {},
    "Mode": 0
  },
  {
    "Id": "78c3b51e-fd9a-485b-91ce-bc0a8171c89d",
    "Name": "tg2",
    "Type": "ISCSI",
    "Running": false,
    "ACL": false,
    "ChapAuth": false,
    "CHAP": {},
    "Mode": 0
  }
]

To print complete information about all target groups, use vstorage-target tg-list -all.

7.3.4. Printing Details of Target Groups

To print the details of a specific target group, use the vstorage-target tg-status command. For example:

# vstorage-target tg-status -id faeacacd-eba6-416c-9a7f-b5ba9e372e16

This command prints the complete details of the target group with the ID faeacacd-eba6-416c-9a7f-b5ba9e372e16. One parameter to pay attention to is NodeState. It indicates whether a node is in sync with the target group, i.e. aware of its current configuration. The following states can be shown:

  • synced, node is in sync with the target group.
  • syncing, node is syncing with the target group.
  • failed, node failed to sync with the target group (see the Error parameter for details).
  • offline, node is offline.
  • disabled, node is disabled and its target is offline.

7.3.5. Managing Persistent Reservations of Target Groups

SCSI-2 reservations allow initiators to gain exclusive access to a LUN and prevent other initiators from making changes to that LUN at the same time. Such reservations are typically released by the initiator after changes have been made to the LUN. They are, however, also released on initiator failures or logical unit resets. SCSI-3 introduces persistent reservations that remain in case of failures or resets and are released by the initiator when needed. They also allow multiple initiators to communicate with the LUN in a controlled manner.

In Acronis Cyber Infrastructure, persistent reservations are used mostly to support Microsoft Hyper-V nodes working in Failover Clusters.

SCSI persistent reservations are enabled by default. You can enable and disable them—for all volumes in the target group—as follows:

# vstorage-target tg-pr -id <tg_ID> -enable
# vstorage-target tg-pr -id <tg_ID> -disable

Where <tg_ID> is the ID of the target group for which persistent reservations are set.

Note

For persistent reservations to work, the vstorage-target-manager service must be running on all MDS nodes.

7.3.6. Deleting Target Groups

To delete a target group, use the vstorage-target tg-delete command. For example:

# vstorage-target tg-delete -id 3d8364f5-b830-4211-85af-3a19d30ebac4

This command deletes the target group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4.