1. Operations
2. vcenter
3. vm
4. hardware
5. cpu

## vcenter vm hardware cpu: update

Updates the CPU-related settings of a virtual machine.

### Request:

#### HTTP request

PATCH https://{server}/rest/vcenter/vm/{vm}/hardware/cpu

#### Path Parameters

Name | Type | Description
--- | --- | ---
Required
vm | string | Virtual machine identifier.

#### Request Body Structure:

- JSON
- XML

{
"spec": {
"cores_per_socket": 1,
"count": 1,
"hot_add_enabled": true,
"hot_remove_enabled": true
}
}
<?xml version="1.0" ?>
<ns0:Update-Input xmlns:ns0="http://vmware.com/vcenter/vm/hardware/cpu" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<spec>
<count>1</count>
<hot_remove_enabled>true</hot_remove_enabled>
<hot_add_enabled>true</hot_add_enabled>
<cores_per_socket>1</cores_per_socket>
</spec>
</ns0:Update-Input>

#### Request Body Parameters:

Name | Type | Description
--- | --- | ---
bold = required
spec | update_spec | Specification for updating the CPU-related settings of the virtual machine.
spec.count | long | New number of CPU cores. The number of CPU cores in the virtual machine must be a multiple of the number of cores per socket. The supported range of CPU counts is constrained by the configured guest operating system and virtual hardware version of the virtual machine. If the virtual machine is running, the number of CPU cores may only be increased if vcenter.vm.hardware.cpu.info.hot_add_enabled is true, and may only be decreased if vcenter.vm.hardware.cpu.info.hot_remove_enabled is true. Optional. If unset, the value is unchanged.
spec.cores_per_socket | long | New number of CPU cores per socket. The number of CPU cores in the virtual machine must be a multiple of the number of cores per socket. Optional. If unset, the value is unchanged.
spec.hot_add_enabled | boolean | Flag indicating whether adding CPUs while the virtual machine is running is enabled. This field may only be modified if the virtual machine is powered off. Optional. If unset, the value is unchanged.
spec.hot_remove_enabled | boolean | Flag indicating whether removing CPUs while the virtual machine is running is enabled. This field may only be modified if the virtual machine is powered off. Optional. If unset, the value is unchanged.

### Response:

#### HTTP Status Code: 200

None

#### Errors:

HTTP Status Code | Type | Description
--- | --- | ---
500 | error | if the system reports an error while responding to the request.
404 | not_found | if the virtual machine is not found.
400 | invalid_argument | if one of the provided settings is not permitted; for example, specifying a negative value for `count`.
400 | not_allowed_in_current_state | if `hot_add_enabled` or `hot_remove_enabled` is specified and the virtual machine is not powered off.
400 | resource_busy | if the virtual machine is busy performing another operation.
400 | resource_inaccessible | if the virtual machine's configuration state cannot be accessed.
503 | service_unavailable | if the system is unable to communicate with a service to complete the request.
401 | unauthenticated | if the user can not be authenticated.
403 | unauthorized | if the user doesn't have the required privileges.