Ops Center

 JavaScript Plug-in CMRest out of range of int

  • Hitachi Ops Center
  • Hitachi Ops Center
Shaik Khalid Akram Akbar's profile image
Shaik Khalid Akram Akbar posted 11-06-2018 12:01

Hi all,

In the  Configuration manager Plugin javascript code I am querying the  LDEVs via Objects API

See below sample line of code  pVolStorageDeviceID and curange are  variable (In my case curange = 256)

Code sample

//switching to object API

      var client = new api.ObjectsApi();

    client.getApiClient().setApiKeyPrefix("Session");

    client.getApiClient().setApiKey(token); 

   

   var ldevinfoObj = client.v1.objects.storages.storageDeviceID.ldevs.get(pVolStorageDeviceID, null, null, null, null, null, null, 256, null, null, curange, null, null);

Error

Caused by: com

0892 2018/11/06 12:46:26.431     Automation       3AF37506 32E03AD8 KNAE10100-E      EC   .fasterxml.jackson.core.JsonParseException: Numeric value (2510032896) out of range of int

at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@31f11acd; line: 1621, column: 34]

Somehow the JSON property values is not being able to be stored in a variable because of an out of range integer value.

When I do a Manual REST API Call indeed there is a property value "numOfUsedBlock" : 2510032896

REST API Call O/p

{

  "data" : [ {

    "ldevId" : 256,

    "virtualLdevId" : 256,

    "clprId" : 0,

    "emulationType" : "OPEN-V-CVS",

    "byteFormatCapacity" : "2.00 T",

    "blockCapacity" : 4294967296,

    "numOfPorts" : 2,

    "ports" : [ {

      "portId" : "CL1-A",

      "hostGroupNumber" : 1,

      "hostGroupName" : "HDS-BE-LAB",

      "lun" : 0

    }, {

      "portId" : "CL2-A",

      "hostGroupNumber" : 1,

      "hostGroupName" : "HDS-BE-LAB",

      "lun" : 0

    } ],

    "attributes" : [ "CVS", "HDP", "GAD" ],

    "label" : "BEBRU-ESX",

    "status" : "NML",

    "mpBladeId" : 2,

    "ssid" : "0005",

    "poolId" : 0,

    "numOfUsedBlock" : 2510032896,

    "isFullAllocationEnabled" : false,

    "resourceGroupId" : 1,

    "dataReductionStatus" : "DISABLED",

    "dataReductionMode" : "disabled",

    "isAluaEnabled" : false

  },

Is there a way to circumvent this issue - and be able to store the o/p of the get.ldev in a variable within the JS code.

Thanks,

Akram.


#HitachiOpsCenter
Craig Chan's profile image
Craig Chan

Your block is larger than an INT value (int is up to 2147483647).  Can you put the value into a long instead?  Or is this something that HAD is trying to put into a variable for you?

Shaik Khalid Akram Akbar's profile image
Shaik Khalid Akram Akbar

Hi Craig,

Yes, that is my understanding as well  that the values should be long.  But this is something I am not putting this value explicitly in a variable with INT .

I am querying a Ldev ( in the "JavaScript Plugin for CMRest" ) and the output is a JSON object. And if  any particular LDEV that has a property with used capacity ( numOfUsedBlock) value greater than 2147483647 the javascript plugin stops executing with the error I had mentioned above.

 

There is no explicit long data type in javascript as far as I know.  JavaScript data types and data structures - JavaScript | MDN

I don't know how to make the variable hold a JSON object that has property value  bigger than 2147483647 in the HAD. Looks to me  like the JSON parser in the HAD is causing this, but not sure.

 

Regards,

 

Akram

 

 

Motoki Yoshimura's profile image
Motoki Yoshimura

Hello,

This looks like the issue we resolved in HAD 8.5.4-02 which occurs in the JavaScript Plug-in for Configuration Manager REST Plug-in when a property value is 2,147,483,647 or more.

Can you try upgrading HAD to 8.5.4-02 or later?

Shaik Khalid Akram Akbar's profile image
Shaik Khalid Akram Akbar

Thank you for the feedback. I am running HAD version 8.6.1-01. 

But the Plugin step I was using was still from 8.5.4 I think as I has imported the service that I created in that version.

pastedimage_2

After Changing the plugin version to 1.61, this is okay now.

pastedimage_6

Is there a alternative way to upgrade the plugin version on existing templates that were imported from pre 8.5.4.

Now I had copied  the script and altered the property variables - is this the way to go ?

Thanks,

Akram.