Highlighted
systeme_tt
1 Copper

Unity REST API hostAccess

Jump to solution

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

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChrisHolloway
2 Bronze

Re: Unity REST API hostAccess

Jump to solution

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}]}}';

0 Kudos
2 Replies
systeme_tt
1 Copper

Re: Unity REST API hostAccess

Jump to solution

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 ?

0 Kudos
ChrisHolloway
2 Bronze

Re: Unity REST API hostAccess

Jump to solution

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}]}}';

0 Kudos