AddVirtualNetwork

You can use the AddVirtualNetwork method to add a new virtual network to a cluster configuration.

When you add a virtual network, an interface for each node is created and each interface requires a virtual network IP address. The number of IP addresses you specify as a parameter for this API method must be equal to or greater than the number of nodes in the cluster. The system bulk provisions virtual network addresses and assigns them to individual nodes automatically. You do not need to assign virtual network addresses to nodes manually.

Note: The AddVirtualNetwork method is used only to create a new virtual network. If you want to make changes to an existing virtual network, use the ModifyVirtualNetwork method.

Parameters

This method has the following input parameters:

Name Description Type Default value Required
addressBlocks Unique range of IP addresses to include in the virtual network. Required members for the object:
  • start: The start of the IP address range. (string)
  • size: The number of IP addresses to include in the block. (integer)
JSON object array None Yes
attributes List of name-value pairs in JSON object format. JSON object None No
gateway The IP address of a gateway of the virtual network. This parameter is valid only if the namespace parameter is set to true. string None No
name A user-defined name for the new virtual network. string None Yes
namespace When set to true, enables the Routable Storage VLANs functionality by creating and configuring a namespace and the virtual network contained by it. boolean None No
netmask Unique network mask for the virtual network being created. string None Yes
svip Unique storage IP address for the virtual network being created. string None Yes
virtualNetworkTag A unique virtual network (VLAN) tag. Supported values are 1 through 4094. integer None Yes
Note: Virtual network parameters must be unique to each virtual network when you set namespace to false.

Return value

This method has the following return value:

Name Description Type
virtualNetworkID The virtual network ID of the new virtual network. integer

Request example

Requests for this method are similar to the following example:

{
  "method": "AddVirtualNetwork",
  "params": {
    "virtualNetworkTag": 2010,
    "name": "network1",
    "addressBlocks" : [
        { "start": "192.86.5.1", "size": 10 },
        { "start": "192.86.5.50", "size": 20 }
    ],
    "netmask" : "255.255.192.0",
    "gateway" : "10.0.1.254",
    "svip" : "192.86.5.200",
    "attributes" : {}
    "namespace" : true
  },
"id": 1
}

Response example

This method returns a response similar to the following example:

{
   "id": 1,
   "result": 
      {
        "virtualNetworkID": 5
   }
}