Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

1707

February 14th, 2018 08:00

Unity REST API hostAccess

Hi everyone,

I'm trying to script LUN creation for Unity 500 with the REST API, but i have some issue with hostAccess configuration.

I tried to follow the apidocs on the https://unity_ip/apidocs/ but i think i missed how this api work.

I can create a simple LUN with :

my $body = '{"name":"'.$lun_name.'","lunParameters":{"pool":{"id":"pool_2"},"size":'.$lun_size.',"isThinEnabled":"false"}}';

$client->POST("/api/types/storageResource/action/createLun", $body);

But when i want to add the hostAccess configuration i have this following error :

"httpStatusCode":422,"messages":[{"en-US":"The LUN or consistency group host access parameter is invalid. (Error Code:0x6701026)"}]

The body request was :

my $body = '{"name":"'.$lun_name.'","lunParameters":{"pool":{"id":"pool_2"},"size":'.$lun_size.',"isThinEnabled":"false","hostAccess":[{"host":{"id":"Host_6"}}]}}';

Thanks for your help

February 15th, 2018 05:00

I think you need to include the "accessMask" in your "hostAccess" .  So for a production access to a LUN you would need:


my $body = '{"name":"'.$lun_name.'","lunParameters":{"pool":{"id":"pool_2"},"size":'.$lun_size.',"isThinEnabled":"false","hostAccess":[{"host":{"id": "Host_6"},"accessMask": 1}]}}';

February 15th, 2018 05:00

Hi,

It's looks like the attriube accesMask was required.

Everything works fine with this body configuration

{

     "name":"TEST226",

     "lunParameters":{

          "pool":{"id":"pool_2"},

          "size":"10000000000",

          "isThinEnabled":"false",

          "hostAccess":[{

               "host":{"id":"Host_6"},

               "accessMask":"1"}

          ]

     }

}

Now, i have a similar issue with HLU modification : /api/instances/host/Host_6/action/modifyHostLUNs

i use this body, but this is not working :


{

     "hostLunModifyList":{

          "hostLUN":{

               "id": "Host_6_sv_33_prod"

          },

          "hlu":"10"

     }

}


What's wrong with this ?

How to identify the required parameter ?

No Events found!

Top