Skip to main content

We've Moved!

Product Documentation has moved to docs.hitachivantara.com
Hitachi Vantara Knowledge

Modifying a smart provisioning service with the REST API

Learn how to use the Ops Center Automator REST API to modify a smart provisioning service.

Editing the property list of a service

Here are the basic steps to edit the property list:

  1. Acquire the target service ID (instance ID).
  2. Acquire the property list ID of the service.
  3. Acquire the property values.
  4. Modify the property values.
  5. Save the file.
  6. Update the modified property list.

Perform the following detailed steps:

Procedure

  1. Obtain the instance ID of a provisioning service that you want to edit:

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/Services"

    The following is an excerpt of an output example.

    {
      "data" : [ {
        "instanceID" : 11674,
        "name" : "Automator_SERVICE",
        "description" : "Intelligent allocation service that uses sets of volumes from the associated infrastructure group to be consumed by server(s) running a generic application",
        "tags" : "Add New Storage",
        "serviceTemplateName" : "Allocate Volumes for Generic Application",
        "createTime" : "2014-11-07T21:22:27.000+09:00",
        "modifyTime" : "2014-11-12T13:03:33.000+09:00",
        "serviceState" : "release",
        "serviceGroupName" : "Default Service Group",
        "iconURL" : "https://10.197.194.100:22016/Automation/icon/services/com.hitachi.software.dna.cts/SP_GenericApplication/01.00.00",
        "vendorName" : "MyCompany, Ltd.",
        "version" : "01.00.00",
        "lastSubmitTime" : "2014-11-12T12:45:19.000+09:00",
        "favorite" : false,
        "failedCount" : 0,
        "completedCount" : 0,
        "executedCount" : 0,
        "latest" : true,
        "imageURL" : "https://10.197.194.100:22016/Automation/services/custom/000000000011624/SP_GenericApplication_overview.png",
        "supportedScheduleType" : "immediate,schedule",
        "supportedActionType" : "",
        "submitCount" : 0,
        "serviceTemplateID" : 11624,
        "serviceGroupID" : 3
      } ],
      "count" : 1
    }
    NoteThe instanceID or serviceID of the service in the example is 11674.
  2. Obtain the instance ID of the property list containing the property values that you want to edit (that belong to serviceID "11674").

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/PropertyValues?serviceID=11674"

    The following is an example of an output excerpt of the property list "11687“ with the keyname property provisioning.volumeSetting.volumeSettings.restriction.

        "instanceID" : 11687,
        "type" : "file",
        "keyName" : "provisioning.volumeSetting.volumeSettings.restriction",
        "value" : "{\n  \"type\": \"array\",\n  \"visibility\": \"exec\",\n  \"readOnly\": true,\n  \"itemInstances\": [\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"usage\": {\n          \"type\": \"string\",\n          \"visibility\": \"exec\",\n          \"readOnly\": true,\n          \"defaultValue\": \"OS\"\n        },\n        \"numberOfVolumes\": {\n          \"type\": \"integer\",\n          \"visibility\": \"exec\",\n          \"optionValues\": {},\n          \"defaultValue\": \"1\"\n        },\n        \"capacity\": {\n          \"type\": \"capacity\",\n          \"visibility\": \"exec\",\n          \"optionValues\": {},\n          \"defaultValue\": \"150.0GB\"\n        },\n        \"storageProfile\": {\n          \"type\": \"list\",\n          \"visibility\": \"exec\",\n          \"readOnly\": true,\n          \"defaultValue\": \"Gold Write\"\n        },\n        \"ldevLabel\": {\n          \"type\": \"string\",\n          \"visibility\": \"exec\",\n          \"defaultValue\": \"\"\n        },\n        \"ldevSetting\": {\n          \"type\": \"object\",\n          \"hidden\": true,\n          \"properties\": {\n            \"fullAllocation\": {\n              \"type\": \"list\",\n              \"visibility\": \"config\",\n              \"defaultValue\": \"Disable\"\n            }\n          }\n        },\n        \"lunSetting\": {\n          \"type\": \"object\",\n          \"hidden\": true,\n          \"properties\": {\n            \"lunStartsFrom\": {\n              \"type\": \"hex\",\n              \"visibility\": \"config\",\n              \"defaultValue\": \"0\"\n            }\n          }\n        }\n      }\n    }\n  ]\n}",
        "readOnly" : true,
        "hidden" : true,
        "serviceID" : 11674
      }
    NoteTo edit the property of a service (in steps 3 and 4), provide new values for the parameters you want and follow these guidelines:
    • Property values related to volume settings, must be updated through a pair of keynames as follows:

      • provisioning.volumeSetting.volumeSettings.restriction AND provisioning.volumeSetting.volumeSettings.value
      • allocatelikevolumes.volumeSetting.volumeSettings.restriction AND allocatelikevolumes.volumeSetting.volumeSettings.value
      • replication.volumeSetting.volumeSettings.restriction AND replication.volumeSetting.volumeSettings.value
    • If the property attribute type is a file, and the property is not related to volume settings, edit only the properties of associated keynames that end in .value.
  3. Run the following command to output the property values from the property list ID 11687 to a file ( prop11687.json) that you can later edit.

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/PropertyValues/11687" > prop11687.json
    NoteIn this example, the property values are written to the file prop11687.json in your current folder. You can change the folder location (for example), by specifying C:\Users\YourFolder\prop11687.json
  4. Use a text editor (such as Notepad) to change the property value storageProfile from Gold Write to Silver (for example).

    Your modified file should appear as follows:

    {
        "instanceID" : 11687,
        "type" : "file",
        "keyName" : "provisioning.volumeSetting.volumeSettings.restriction",
        "value" : "{\n  \"type\": \"array\",\n  \"visibility\": \"exec\",\n  \"readOnly\": true,\n  \"itemInstances\": [\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"usage\": {\n          \"type\": \"string\",\n          \"visibility\": \"exec\",\n          \"readOnly\": true,\n          \"defaultValue\": \"OS\"\n        },\n        \"numberOfVolumes\": {\n          \"type\": \"integer\",\n          \"visibility\": \"exec\",\n          \"optionValues\": {},\n          \"defaultValue\": \"1\"\n        },\n        \"capacity\": {\n          \"type\": \"capacity\",\n          \"visibility\": \"exec\",\n          \"optionValues\": {},\n          \"defaultValue\": \"150.0GB\"\n        },\n        \"storageProfile\": {\n          \"type\": \"list\",\n          \"visibility\": \"exec\",\n          \"readOnly\": true,\n          \"defaultValue\": \"Silver\"\n        },\n        \"ldevLabel\": {\n          \"type\": \"string\",\n          \"visibility\": \"exec\",\n          \"defaultValue\": \"\"\n        },\n        \"ldevSetting\": {\n          \"type\": \"object\",\n          \"hidden\": true,\n          \"properties\": {\n            \"fullAllocation\": {\n              \"type\": \"list\",\n              \"visibility\": \"config\",\n              \"defaultValue\": \"Disable\"\n            }\n          }\n        },\n        \"lunSetting\": {\n          \"type\": \"object\",\n          \"hidden\": true,\n          \"properties\": {\n            \"lunStartsFrom\": {\n              \"type\": \"hex\",\n              \"visibility\": \"config\",\n              \"defaultValue\": \"0\"\n            }\n          }\n        }\n      }\n    }\n  ]\n}",
        "readOnly" : true,
        "hidden" : true,
        "serviceID" : 11674
      }
  5. Save the file.

  6. Run the following command to update the values in properties list "11687".

    curl -v -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbxxx" -X PUT --data-binary @./prop11687.json "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/PropertyValues/11687"

Submitting an updated service

After you have edited and updated the properties list for a service, you can submit the service to run the related tasks.

The following REST API example modifies the property values of a provisioning service that you can submit through the POST method. The submitted service generates a corresponding task ID that you then can monitor.

NoteWhen you assign new property values to a service, it takes effect when the target service is submitted to run.

Procedure

  1. Run the following command to output the properties of the service you want to submit to the example file, submit_param11674.json.

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/Services/11674/actions/submit" > submit_param11674.json

    The following is an output excerpt listing the serviceID, 11674.

      }, {
        "instanceID" : 11687,
        "type" : "file",
        "keyName" : "provisioning.volumeSetting.volumeSettings.value",
        "value" : "{\n  \"values\": [\n    {\n      \"usage\": \"OS\",\n      \"numberOfVolumes\": \"1\",\n      \"capacity\": \"150.0GB\",\n      \"storageProfile\": \"Silver\",\n      \"ldevLabel\": \"\",\n      \"lunSetting\": {\n        \"lunStartsFrom\": \"0\"\n      }\n    }\n  ]\n}",
        "readOnly" : false,
        "hidden" : false,
        "serviceID" : 11674
      }, {
        "instanceID" : 11673,
        "type" : "file",
        "keyName" : "provisioning.hostSetting.targetHosts.value",
        "value" : "{\r\n  \"values\" : {\r\n  }\r\n}",
        "readOnly" : false,
        "hidden" : false,
        "serviceID" : 11674
      } ]
    }
    
  2. Update the values of the selected properties as in the following example submit_param11674_edited.json file:

    • Number of volumes : 1
    • Capacity of volumes: 150GB
    • Allocate host name : “host01”
    • Device Manager name : “Device Manager Machine”

      Your modified file must be similar to this:

        }, {
          "instanceID" : 11687,
          "type" : "file",
          "keyName" : "provisioning.volumeSetting.volumeSettings.value",
          "value" : "{\n  \"values\": [\n    {\n      \"usage\": \"OS\",\n      \"numberOfVolumes\": \"1\",\n      \"capacity\": \"150.0GB\",\n      \"storageProfile\": \"Silver\",\n      \"ldevLabel\": \"\",\n      \"lunSetting\": {\n        \"lunStartsFrom\": \"0\"\n      }\n    }\n  ]\n}",
          "readOnly" : false,
          "hidden" : false,
          "serviceID" : 11674
        }, {
          "instanceID" : 11673,
          "type" : "file",
          "keyName" : "provisioning.hostSetting.targetHosts.value",
          "value" : "{\r\n  \"values\" : {\r\n  \"deviceManagerName\" : \"Device Manager Machine\",\r\n  \"hosts\" : [ {\r\n      \"name\" : \"host01\"    } ] \r\n  }\r\n}",
          "readOnly" : false,
          "hidden" : false,
          "serviceID" : 11674
        } ]
      }
  3. Run the following command to submit the service.

    curl -v -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbxxx" -X POST --data-binary @submit_param11674.json "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/Services/11674/actions/submit/invoke"

    This is an output example excerpt.

    {
      "instanceID" : "eb607b90-f17f-48c6-9c24-71df1731537e",
      "created" : "2014-11-12T13:11:50.777+09:00",
      "updated" : "2014-11-12T13:11:50.777+09:00",
      "completed" : "2014-11-12T13:11:50.777+09:00",
      "state" : "success",
      "affectedResource" : [ "https://10.197.194.100:22016/Automation/v1/objects/Schedules/14273", "https://10.197.194.100:22016/Automation/v1/objects/Tasks/14293" ]
    }
    NoteThis example generates a task ID of 14293.

Confirming the results

After submitting an updated service, you can confirm the results by viewing the associated task ID. Whenever you submit a service, Hitachi Ops Center Automator creates a corresponding task ID.

Procedure

  1. Run the following command by specifying the run task ID (14293) to get the related task information.

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/Tasks/14293"

    This is an example output. The status indicates that the task is completed.

    {
      "instanceID" : 14293,
      "name" : "Automator_SERVICE_20141112130925",
      "status" : "completed",
      "startTime" : "2014-11-12T13:11:50.000+09:00",
      "completionTime" : "2014-11-12T13:13:52.000+09:00",
      "submitter" : "System",
      "submitTime" : "2014-11-12T13:11:50.000+09:00",
      "modifyTime" : "2014-11-12T13:14:13.000+09:00",
      "serviceState" : "release",
      "scheduleType" : "immediate",
      "description" : "",
      "serviceName" : "Automator_SERVICE",
      "tags" : "Add New Storage",
      "serviceGroupName" : "Default Service Group",
      "toDo" : false,
      "notes" : "", 
      "supportedActionType" : "",
      "serviceTemplateID" : 11624,
      "scheduleID" : 14273,
      "serviceGroupID" : 3,
      "serviceID" : 11674
    }
  2. Run following command to get details of a task result.

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/PropertyValues?taskID=14293"
  3. Run the following command to get task schedule information.

    curl -v -H "Accept: application/json" -H "Authorization: Bearer eyJhbxxx" -X GET "https://automation_software-server-IP-address-or-hostname:22016/Automation/v1/objects/Schedules/14273”

    This is an example of an output excerpt.

    {
      "instanceID" : 14273,
      "name" : "Automator_SERVICE_20141112130925",
      "submitter" : "System",
      "scheduleType" : "immediate",
      "createTime" : "2014-11-12T13:11:50.000+09:00",
      "modifyTime" : "2014-11-12T13:11:50.000+09:00",
      "description" : "",
      "serviceState" : "release",
      "serviceID" : 11674
    }