0 Replies Latest reply: Mar 27, 2013 1:02 AM by jack.yu RSS

    Add a new Disk to VM...

    jack.yu
      Starting from 12.1.0.2 EM with 12.1.0.4 Cloud Self Service Portal plugin, adding a Disk to a VM is supported via the PUT interaction. For example, the following VM currently contains 2 disks:
      -----
      Method: GET /em/cloud/iaas/server/vm/2AC95DBBB9C7CDDFDA4CBCEF0C436651?disks
      Response:
      {
      "disks" :
      [
      [
      "system.img (7)" ,
      "1400"
      ] ,
      [
      "default_disk" ,
      "10240"
      ]
      ]
      }
      -----
      Now, we want to add a new disk of size 1024M with name "addition1".
      -----
      Method: PUT /em/cloud/iaas/server/vm/2AC95DBBB9C7CDDFDA4CBCEF0C436651
      Content-Type: application/oracle.com.cloud.common.VM+json
      Accept: application/oracle.com.cloud.common.VM+json
      Body:
      {
      "disks":
      [
      ["addition1", "1024"]
      ]
      }
      -----
      Here is the response when PUT interaction was successfully accepted
      -----
      {
      "uri" : "/em/cloud/iaas/server/vm/2AC95DBBB9C7CDDFDA4CBCEF0C436651" ,
      "name" : "SPVM" ,
      "resource_state" : {
      "state" : "READY" ,
      "messages" :
      [
      {
      "text" : "'PUT' resource operation on 'application/oracle.com.cloud.common.VM' identified by '2AC95DBBB9C7CDDFDA4CBCEF0C436651' is successfully submitted with reference '41'" ,
      "date" : "2013-03-27T04:44:52+0000"
      }
      ]
      } ,
      ... snipped for brevity
      ------
      After a little while, the new disk will show up in the VM's disks attribute
      ------
      GET /em/cloud/iaas/server/vm/2AC95DBBB9C7CDDFDA4CBCEF0C436651?disks
      Response:
      {
      "disks" :
      [
      [
      "system.img (7)" ,
      "1400"
      ] ,
      [
      "default_disk" ,
      "10240"
      ] ,
      [
      "addition1" ,
      "1024"
      ]
      ]
      }
      ------
      The "disks" attribute can be partially updated to include new disks. It contains a list of list where the inner list contains 2 String elements where the first element denotes the name of the disk, and the second element denotes the size of the disk in MB.

      Currently, if a disk specified in the PUT request already exists, then it will be ignored. In other words, the 12.1.0.4 Cloud Self Service Portal for Enterprise Manager Cloud Control will recognize only disks specified in the PUT request that do not yet exist in the VM, and interpret that as a simple addition.