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.
This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.
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. 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. | ||||
3 | Update the section with your modifications.
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.
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>
202 Accepted Content-Type: application/vnd.vmware.vcloud.task+xml ... <Task ... operation="Updating Virtual Application Linux FTP server (7)" ...> ... </Task>