By default, all hard disks defined in the VirtualHardwareSection of a Vm element use the storage profile specified for the Vm. You can override this default for any of these disks when you instantiate a vApp template, compose or recompose a vApp, or reconfigure a virtual machine.

Every Vm element includes a StorageProfile element. The storage profile referenced in this element normally provides storage for all the hard disk Items in the virtual machine's VirtualHardwareSection. You can override this default by updating the virtual machine's VirtualHardwareSection to add storageProfileOverrideVmDefault and storageProfileHref attributes to the Item that defines the hard disk. You can update a VirtualHardwareSection when you are instantiating a vApp template, composing or recomposing a vApp, or reconfiguring a virtual machine.

Important

You cannot override the default storage profile for any hard disk of a virtual machine that is deployed in a VDC where fast provisioning is enabled.

Verify that you are logged in to the vCloud API as an administrator, Catalog Author, or vApp Author.

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 Example: Retrieve the Hard Disks and Controllers in a Virtual Machine .

2

In the VirtualHardwareSection of the retrieved Vm, modify the rasd:HostResource element of the Item that defines the disk for which you want to override the default storage profile.

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

a

In the VirtualHardwareSection of the Vm, find the Item that represents the hard disk for which you want to override the default storage profile.

b

Add a storageProfileHref to the rasd:HostResource element of the Item and set its value to the href of the storage profile you want to use for this disk. The storage profile you specify must be available in the VDC where this virtual machine is deployed.

c

Add a storageProfileOverrideVmDefault attribute to the rasd:HostResource element of the Item. The value of this attribute controls whether changes to the virtual machine's StorageProfile affect the storage profile that this disk uses.

How storageProfileOverrideVmDefault Values Affect Hard Disk Storage Profile Assignment

Value

Result

true (default)

The storage profile specified in storageProfileHref is always used for this disk regardless of the value specified in the virtual machine's StorageProfile

false

Any storage profile that is specified in storageProfileHref is ignored and the disk is migrated to the storage specified in the virtual machine's StorageProfile.

If you omit the storageProfileOverrideVmDefault attribute, the storageProfileHref is ignored.

3

Update the section with your modifications.

a

In the retrieved section, find the Link element where rel="edit".

b

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.

This example builds on the ones shown in Example: Update the Storage Profile for a Virtual Machine and Example: Modify the Hard Disk Configuration of a Virtual Machine. This virtual machine has the storage profile specified in Example: Update the Storage Profile for a Virtual Machine:

<StorageProfile
   type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"
   name="Gold"
   href="https://vcloud.example.com/api/vdcStorageProfile/3" />

To specify a new storage profile for the disk whose capacity was increased in Example: Modify the Hard Disk Configuration of a Virtual Machine, you must provide the storageProfileHref for the new storage profile and also set the storageProfileOverrideVmDefault attribute to true.

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"
         vcloud:storageProfileOverrideVmDefault="true"
         vcloud:storageProfileHref="https://vcloud.example.com/api/vdcStorageProfile/5">
      </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>

Response:

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