The CPU configuration of a virtual machine is represented by an Item in its VirtualHardwareSection element.

Verify that you are logged in to the vCloud API as a system administrator or the object owner.

1

Retrieve the CPU section to modify.

Make a GET request to the URL in the section's href attribute value:

GET https://vcloud.example.com/api/vApp/vm-4/virtualHardwareSection/cpu
2

Modify the retrieved section.

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.

3

Update the section with your modifications.

Find the Link element in the section where rel="edit". 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.

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.

This request modifies the CPU section of the virtual machines shown in Example: Configuration Links in a Vm Element. The modified Item in the request body adds a second CPU to the Vm by changing the rasd:VirtualQuantity value of the Item to 2.

Request:

PUT https://vcloud.example.com/api/vApp/vm-4/virtualHardwareSection/cpu
Content-type: application/vnd.vmware.vcloud.rasdItem+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
   xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
   vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
   <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
   <rasd:Description>Number of Virtual CPUs</rasd:Description>
   <rasd:ElementName>2 virtual CPU(s)</rasd:ElementName>
   <rasd:InstanceID>4</rasd:InstanceID>
   <rasd:Reservation>0</rasd:Reservation>
   <rasd:ResourceType>3</rasd:ResourceType>
   <rasd:VirtualQuantity>2</rasd:VirtualQuantity>
   <rasd:Weight>0</rasd:Weight>
</Item>

Response:

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