7.6. Managing Targets and Portals

This section describes how to create and manage targets.

The optimal way is to create a single target per node if you use the iSCSI protocol and one target per FC port if you use the FC protocol.

7.6.1. Creating Targets

Typically, targets are created automatically when you create target groups or add nodes to them. However, as you can delete target(s) from a node without removing the node from a target group, you can also create target(s) on such a node again. Use the vstorage-target target-create command. For example:

# vstorage-target target-create -tg 3d8364f5-b830-4211-85af-3a19d30ebac4 -json target.json

This command creates a target based on the target.json configuration file in the target group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4. The configuration file lists target details like the node to create the target on, WWN, and portal. For example:

{
  "NodeId": "bbfd0e7a26b1406d",
  "WWN": "iqn.2013-10.com.vstorage:test22",
  "Portals": [
    {
      "Addr": "10.94.104.90",
      "Port": 3260
    }
  ]
}

7.6.2. Adding and Removing Target Portals

To add a portal to a target, use the vstorage-target target-portal add command. For example:

# vstorage-target target-portal add -wwn iqn.2013-10.com.vstorage:test2 -addr 10.94.104.90 \
-tg 3d8364f5-b830-4211-85af-3a19d30ebac4

This command adds a portal with the IP address 10.94.104.90 and default port 3260 to the target with the IQN iqn.2013-10.com.vstorage:test2 in the target group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4.

To delete a portal from a target, use the vstorage-target target-portal del command. For example:

# vstorage-target target-portal del -wwn iqn.2013-10.com.vstorage:test2 -addr 10.94.104.90 \
-tg 3d8364f5-b830-4211-85af-3a19d30ebac4

This command deletes the portal created before.

7.6.3. Deleting Targets

To delete a target from a target group (as well as the node it is on), use the vstorage-target target-delete command. For example:

# vstorage-target target-delete -tg 3d8364f5-b830-4211-85af-3a19d30ebac4 \
-wwn iqn.2013-10.com.vstorage:test22

This command deletes the target with the IQN iqn.2013-10.com.vstorage:test22 from the target group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4 and from the node it is located on.

A node that has no targets left on it is deleted from the target group.