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

Prerequisites

This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.

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.

    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.
    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 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.

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>
   <vmw:CoresPerSocket ovf:required="false">2</vmw:CoresPerSocket>
</Item>
Response:
202 Accepted
Content-Type: application/vnd.vmware.vcloud.task+xml
...
<Task ... operation="Updating Virtual Application Linux FTP server (7)" ...>
...
</Task>