The hard disk configuration of a virtual machine is represented by one or more Item elements in its VirtualHardwareSection.

Prerequisites

This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.Verify that you are logged in to the vCloud Air Compute Service as an End User.

Procedure

  1. Retrieve the hard disk configuration from the virtual machine.
    Make a GET request to the virtual machine's virtualHardwareSection/disks link.
    GET https://vcloud.example.com/api/vApp/vm-4/virtualHardwareSection/disks
    The response to this kind of request is a RasdItemsList element that contains an Item element for each of the virtual machine's hard disks and hard disk controllers, as shown in Retrieve the Hard Disks and Controllers in a Virtual Machine.
    Important:
    If an independent disk is attached to the virtual machine, it is included in this list, but cannot be modified by this operation. Attached independent disks are distinguished by the appearance of a vcloud:disk attribute in the containing Item, as shown here:
    <rasd:HostResource
       ...
       vcloud:disk="https://vcloud.example.com/api/disk/128" />
    If you need to modify an independent disk while it is attached to a virtual machine, you must use the reconfigureVm operation. See Update Multiple Sections of a Virtual Machine.
  2. Modify the retrieved section.

    Request bodies must contain all required elements and attributes, even if you are not changing their values. Because optional elements and attributes typically revert to default values if they are omitted or empty, it is a best practice to include optional elements in request bodies that modify existing objects. Link elements and href attributes from responses do not need to be included in modified sections. Some elements and attributes are read-only and cannot be modified. See the schema reference for details.

    You cannot modify the values of the busType and busSubType attributes after you create a new disk. When creating a new disk, be sure to set the values of busType and busSubType to a valid combination.

    Table 1. Valid Combinations of busType and busSubType
    busType busSubType Controller
    5 null IDE controller
    6 buslogic BusLogic Parallel SCSI controller
    6 lsilogic LSI Logic Parallel SCSI controller
    6 lsilogicsas LSI Logic SAS SCSI controller
    6 VirtualSCSI Paravirtual SCSI controller
    20 vmware.sata.ahci SATA controller (hardware version 10 and later)
    Note: If you remove all the hard disk objects (RASD resource type 17) from the RasdItemsList container for disks in the VirtualHardwareSection, the system also removes all hard disk controllers (RASD resource type 5) from that section.
  3. Update the section with your modifications.
    1. In the retrieved section, find the Link element where rel="edit".
    2. Make a PUT request to the URL in that link's href attribute value, and supply the modified section as the request body.
    The response to this request is a Task element that tracks the update operation. When the task is complete, the section is updated.

Results

The modified section replaces the contents of the original section. For some section types, modifications take effect immediately. For others, modifications take effect only after a power or deployment state change.

Example: Modify the Hard Disk Configuration of a Virtual Machine

The following request increases the capacity of the hard disk from 1GB to 10GB by changing the vcloud:capacity value of the Item that defines the disk. The capacity is raised from 1024 to 10240. The request body includes the entire RasdItemsList returned by the request shown in Step 1, even though only one element is changed. Link elements from a response are ignored if you include them in a request, so they are omitted in this example.

Request:
PUT https://vcloud.example.com/api/vApp/vm-4/virtualHardwareSection/disks
Content-Type: application/vnd.vmware.vcloud.rasditemslist+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<RasdItemsList
   xmlns="http://www.vmware.com/vcloud/v1.5"
   xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
   type="application/vnd.vmware.vcloud.rasdItemsList+xml" >
   <Item>
      <rasd:Address>0</rasd:Address>
      <rasd:Description>SCSI Controller</rasd:Description>
      <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
      <rasd:InstanceID>2</rasd:InstanceID>
      <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
      <rasd:ResourceType>6</rasd:ResourceType>
   </Item>
   <Item>
      <rasd:AddressOnParent>0</rasd:AddressOnParent>
      <rasd:Description>Hard disk</rasd:Description>
      <rasd:ElementName>Hard disk 1</rasd:ElementName>
      <rasd:HostResource
         xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
         vcloud:capacity="10240"
         vcloud:busSubType="lsilogic"
         vcloud:busType="6"></rasd:HostResource>
      <rasd:InstanceID>2000</rasd:InstanceID>
      <rasd:Parent>2</rasd:Parent>
      <rasd:ResourceType>17</rasd:ResourceType>
   </Item>
   <Item>
      <rasd:AddressOnParent>1</rasd:AddressOnParent>
      <rasd:Description>Hard disk</rasd:Description>
      <rasd:ElementName>Hard disk 2</rasd:ElementName>
      <rasd:HostResource
         xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
         vcloud:capacity="2048"
         vcloud:busSubType="lsilogic"
         vcloud:busType="6"></rasd:HostResource>
      <rasd:InstanceID>2001</rasd:InstanceID>
      <rasd:Parent>2</rasd:Parent>
      <rasd:ResourceType>17</rasd:ResourceType>
   </Item>
   <Item>
      <rasd:Address>0</rasd:Address>
      <rasd:Description>IDE Controller</rasd:Description>
      <rasd:ElementName>IDE Controller 0</rasd:ElementName>
      <rasd:InstanceID>3</rasd:InstanceID>
      <rasd:ResourceType>5</rasd:ResourceType>
   </Item>
</RasdItemsList>

The response is a task.

Response:
202 Accepted
Content-Type: application/vnd.vmware.vcloud.task+xml
...
<Task ... operation="Updating Virtual Application Linux FTP server (7)" ...>
...
</Task>