By default, new and imported virtual machines obtain their resource allocation settings from the organization virtual data center on which they reside. System administrators can create a virtual machine with custom CPU and memory reservation, limit, and shares settings that are different from the values configured for the target organization VDC.
Typically, when creating virtual machines, users cannot configure custom VM reservation, limit, and shares settings. Importing or adopting a virtual machine does not retain the VM reservation, limit, and shares settings that are configured in vCenter Server. Uploading OVF templates does not retain the VM reservation, limit, and shares settings too. Newly created or imported virtual machines obtain their resource allocation settings from their organization virtual data centers.
During an instantiation from a template, you cannot reconfigure the VM reservation, limit, and shares settings.
By using the VmSpecSection section, you can create a VM with custom reservation, limit, and shares values for both CPU and memory. You can also use this section to reconfigure the resource allocation settings of a virtual machine.
When you upload a VM with custom reservation, limit, and shares settings as a VM template to a catalog, the VM template retains the custom settings. Instantiations from a VM template with custom reservation, limit, and shares settings retain the custom settings but might fail if the custom settings exceed the default values per VM for the target VDC.
Copying or moving a VM with custom reservation, limit, and shares settings retains the custom settings but might fail if the custom settings exceed the default values per VM for the target VDC.
Prerequisites
This operation is restricted to system administrators and users assigned with roles that have the right vApp: Edit VM CPU and Memory Reservation / Limit / Shares in all VDC types.
Procedure
Example: Create a VM with Custom CPU and Memory Reservation, Limit, and Shares Settings
POST https://vcloud.example.com/api/vdc/23/action/createvm Content-Type: application/vnd.vmware.vcloud.CreateVmParams+xml ... <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <CreateVmParams xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns6="http://www.vmware.com/schema/ovf" xmlns:ns7="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns8="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns9="http://www.vmware.com/vcloud/versions"> <Description>some description</Description> <CreateVm name="blank-vm1-name"> <VmSpecSection Modified="true"> <ns2:Info>Virtual Machine specification</ns2:Info> <OsType>windows9Server64Guest</OsType> <NumCpus>1</NumCpus> <NumCoresPerSocket>1</NumCoresPerSocket> <CpuResourceMhz> <Configured>1</Configured> <Reservation>0</Reservation> <Limit>1000</Limit> <SharesLevel>CUSTOM</SharesLevel> <Shares>1000</Shares> </CpuResourceMhz> <MemoryResourceMb> <Configured>1000</Configured> <Reservation>600</Reservation> <Limit>1000</Limit> <SharesLevel>CUSTOM</SharesLevel> <Shares>1000</Shares> </MemoryResourceMb> <DiskSection> <DiskSettings> <SizeMb>4</SizeMb> <UnitNumber>0</UnitNumber> <BusNumber>0</BusNumber> <AdapterType>4</AdapterType> <ThinProvisioned>false</ThinProvisioned> <StorageProfile href="https://vcloud.example.com/api/vdcStorageProfile/71" id="71" name="*" type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"/> <overrideVmDefault>true</overrideVmDefault> </DiskSettings> </DiskSection> <HardwareVersion>vmx-11</HardwareVersion> <VirtualCpuType>VM64</VirtualCpuType> </VmSpecSection> <GuestCustomizationSection> <ns2:Info>Guest Customization specification</ns2:Info> <ComputerName>computername</ComputerName> </GuestCustomizationSection> </CreateVm> </CreateVmParams>
Response-Code: 202 Content-type: application/vnd.vmware.vcloud.task+xml ... <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Task ... operation="Composing blank-vm1-name-cb (86)" operationName="vdcComposeVapp" ...> <Owner .../> <User .../> <Organization .../> <Progress>1</Progress> <Details/> </Task>