Create a host group with a name longer than 16 characters:
>>> body = '{"portId": "CL1-A", "hostGroupName": "a_long_host_group_name"}'
>>> url = vsp.baseUrl + vsp.objectUrl + '/host-groups'
>>>
>>> r = vsp.apiSession.post(url=url, data=body, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "jobId" : 2,\n "self" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/jobs/2",\n "userId" : "maintenance",\n "status" : "Initializing",\n "state" : "Queued",\n "createdTime" : "2018-02-01T13:45:42Z",\n "updatedTime" : "2018-02-01T13:45:42Z",\n "request" : {\n "requestUrl" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/host-groups",\n "requestMethod" : "POST",\n "requestBody" : "{\\"portId\\": \\"CL1-A\\", \\"hostGroupName\\": \\"a_long_host_group_name\\"}"\n }\n}'
>>>
>>> url = vsp.baseUrl + vsp.objectUrl + '/jobs/2'
>>>
>>> r = vsp.apiSession.get(url=url, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "jobId" : 2,\n "self" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/jobs/2",\n "userId" : "maintenance",\n "status" : "Completed",\n "state" : "Succeeded",\n "createdTime" : "2018-02-01T13:45:42Z",\n "updatedTime" : "2018-02-01T13:45:43Z",\n "completedTime" : "2018-02-01T13:45:43Z",\n "request" : {\n "requestUrl" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/host-groups",\n "requestMethod" : "POST",\n "requestBody" : "{\\"portId\\": \\"CL1-A\\", \\"hostGroupName\\": \\"a_long_host_group_name\\"}"\n },\n "affectedResources" : [ "/ConfigurationManager/v1/objects/storages/7000000XXXXX/host-groups/CL1-A,2" ]\n}'
Querying by host group shows the full name:
>>>
>>> url = vsp.baseUrl + vsp.objectUrl + '/host-groups/CL1-A,2'
>>>
>>> r = vsp.apiSession.get(url=url, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "hostGroupId" : "CL1-A,2",\n "portId" : "CL1-A",\n "hostGroupNumber" : 2,\n "hostGroupName" : "a_long_host_group_name",\n "hostMode" : "LINUX/IRIX"\n}'
Create and provision a volume to the host group:
>>>
>>> url = vsp.baseUrl + vsp.objectUrl + '/ldevs'
>>> body = '{"ldevId": 53248, "poolId": 0, "byteFormatCapacity": "3G"}'
>>>
>>> r = vsp.apiSession.post(url=url, data=body, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "jobId" : 3,\n "self" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/jobs/3",\n "userId" : "maintenance",\n "status" : "Initializing",\n "state" : "Queued",\n "createdTime" : "2018-02-01T13:54:52Z",\n "updatedTime" : "2018-02-01T13:54:52Z",\n "request" : {\n "requestUrl" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/ldevs",\n "requestMethod" : "POST",\n "requestBody" : "{\\"ldevId\\": 53248, \\"poolId\\": 0, \\"byteFormatCapacity\\": \\"3G\\"}"\n }\n}'
>>>
>>> url = vsp.baseUrl + vsp.objectUrl + '/jobs/3'
>>>
>>> r = vsp.apiSession.get(url=url, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "jobId" : 3,\n "self" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/jobs/3",\n "userId" : "maintenance",\n "status" : "Completed",\n "state" : "Succeeded",\n "createdTime" : "2018-02-01T13:54:52Z",\n "updatedTime" : "2018-02-01T13:55:04Z",\n "completedTime" : "2018-02-01T13:55:04Z",\n "request" : {\n "requestUrl" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/ldevs",\n "requestMethod" : "POST",\n "requestBody" : "{\\"ldevId\\": 53248, \\"poolId\\": 0, \\"byteFormatCapacity\\": \\"3G\\"}"\n },\n "affectedResources" : [ "/ConfigurationManager/v1/objects/storages/7000000XXXXX/ldevs/53248" ]\n}'
>>>
>>> body = '{"portId": "CL1-A", "hostGroupNumber": 2, "ldevId": 53248}'
>>> url = vsp.baseUrl + vsp.objectUrl + '/luns'
>>>
>>> r = vsp.apiSession.post(url=url, data=body, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "jobId" : 4,\n "self" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/jobs/4",\n "userId" : "maintenance",\n "status" : "Initializing",\n "state" : "Queued",\n "createdTime" : "2018-02-01T13:58:14Z",\n "updatedTime" : "2018-02-01T13:58:14Z",\n "request" : {\n "requestUrl" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/luns",\n "requestMethod" : "POST",\n "requestBody" : "{\\"portId\\": \\"CL1-A\\", \\"hostGroupNumber\\": 2, \\"ldevId\\": 53248}"\n }\n}'
>>>
>>> url = vsp.baseUrl + vsp.objectUrl + '/jobs/4'
>>> r = vsp.apiSession.get(url=url, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "jobId" : 4,\n "self" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/jobs/4",\n "userId" : "maintenance",\n "status" : "Completed",\n "state" : "Succeeded",\n "createdTime" : "2018-02-01T13:58:14Z",\n "updatedTime" : "2018-02-01T13:58:15Z",\n "completedTime" : "2018-02-01T13:58:15Z",\n "request" : {\n "requestUrl" : "/ConfigurationManager/v1/objects/storages/7000000XXXXX/luns",\n "requestMethod" : "POST",\n "requestBody" : "{\\"portId\\": \\"CL1-A\\", \\"hostGroupNumber\\": 2, \\"ldevId\\": 53248}"\n },\n "affectedResources" : [ "/ConfigurationManager/v1/objects/storages/7000000XXXXX/luns/CL1-A,2,0" ]\n}'
Get mapping details of the volume, showing the host group name truncated:
>>>
>>> url = vsp.baseUrl + vsp.objectUrl + '/ldevs/53248'
>>> r = vsp.apiSession.get(url=url, verify=vsp.certPath, headers=vsp.headers)
>>> r.content
b'{\n "ldevId" : 53248,\n "clprId" : 0,\n "emulationType" : "OPEN-V-CVS",\n "byteFormatCapacity" : "3.00 G",\n "blockCapacity" : 6291456,\n "numOfPorts" : 1,\n "ports" : [ {\n "portId" : "CL1-A",\n "hostGroupNumber" : 2,\n "hostGroupName" : "a_long_host_grou",\n "lun" : 0\n } ],\n "attributes" : [ "CVS", "HDT" ],\n "status" : "NML",\n "mpBladeId" : 1,\n "ssid" : "00D4",\n "poolId" : 0,\n "numOfUsedBlock" : 0,\n "isRelocationEnabled" : true,\n "tierLevel" : "all",\n "usedCapacityPerTierLevel1" : 0,\n "usedCapacityPerTierLevel2" : 0,\n "tierLevelForNewPageAllocation" : "H",\n "resourceGroupId" : 0,\n "dataReductionStatus" : "DISABLED",\n "dataReductionMode" : "disabled",\n "isAluaEnabled" : false\n}'