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

## vcenter vm hardware memory: update

Updates the memory-related settings of a virtual machine.

### Request:

#### HTTP request

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

#### Path Parameters

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

#### Request Body Structure:

- JSON
- XML

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

#### Request Body Parameters:

Name | Type | Description
--- | --- | ---
bold = required
spec | update_spec | Specification for updating the memory-related settings of the virtual machine.
spec.size_MiB | long | New memory size in mebibytes. The supported range of memory sizes is constrained by the configured guest operating system and virtual hardware version of the virtual machine. If the virtual machine is running, this value may only be changed if vcenter.vm.hardware.memory.info.hot_add_enabled is true, and the new memory size must satisfy the constraints specified by vcenter.vm.hardware.memory.info.hot_add_increment_size_MiB and vcenter.vm.hardware.memory.info.hot_add_limit_MiB. Optional. If unset, the value is unchanged.
spec.hot_add_enabled | boolean | Flag indicating whether adding memory while the virtual machine is running should be enabled. Some guest operating systems may consume more resources or perform less efficiently when they run on hardware that supports adding memory while the machine is running. This field may only be modified if the virtual machine is not powered on. 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 `size_MiB`.
400 | not_allowed_in_current_state | if `hot_add_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.