5.5

Table Of Contents
Retrieve or Modify the CPU Configuration of a Virtual Machine
The CPU configuration of a virtual machine is represented by an Item in its VirtualHardwareSection
element.
Prerequisites
Verify that you are logged in to the vCloud API as an administrator or vApp Author.
Procedure
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.
Example: Modify the CPU Configuration of a Virtual Machine
The initial configuration for the virtual machine used in this example shows a single CPU and
CoresPerSocket value of 1.
<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"
xmlns:vmw="http://www.vmware.com/schema/ovf"
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>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket>
</Item>
This request modifies the CPU section to add a second CPU to the Vm by changing the rasd:VirtualQuantity
value of the Item to 2. It also raises the value of CoresPerSocket to 2.
vCloud API Programming Guide
136 VMware, Inc.