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, for example, iqn.2013-10.com.vstorage:test1 (you can only customize the last part after the colon).
  • 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, for example, 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.