# API cấu hình lại Memory của VM

## <mark style="color:green;">**Tổng quan**</mark> <a href="#overview" id="overview"></a>

Trong tài liệu này, bạn sẽ tìm thấy thông tin chi tiết về cách chuẩn bị thông tin, lấy thông tin bộ nhớ của VM, và cấu hình lại bộ nhớ của VM.

## <mark style="color:green;">Quy trình</mark>

{% stepper %}
{% step %}
**Bước 1: Chuẩn bị thông tin**

Đăng nhập vào **IAM portal** -> **vCD portal**: thu thập thông tin

* {{vcd\_url}}<br>

  <figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/ejv5HXirFC8CB5bT6Syf/image.png" alt=""><figcaption></figcaption></figure>

\- {{vm-uuid}}: Chọn VM -> xem vm **uuid** trên url<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/gMviLJAtkTiAohaPZsEs/image.png" alt=""><figcaption></figcaption></figure>

-{{Bearer Token}}: Vui lòng tham khảo tài liệu "[API đăng nhập bằng Token](https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-dang-nhap-bang-token)"
{% endstep %}

{% step %}
**Bước 2:** Lấy thông tin bộ nhớ của VM

* GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/memory
* Authorization: {{Bearer Token}}
* Headers:

\- ‘Accept’: \*/\*;version=37.2

\- ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/y0N7BHlUiugM4mg7LNSf/image.png" alt=""><figcaption></figcaption></figure>

* SEND request.

Copy **Response Body**
{% endstep %}

{% step %}
**Bước 3:** Cấu hình lại bộ nhớ của VM

* PUT https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/memory
* Authorization: {{Bearer Token }}
* Headers:

-'Accept: */*;version=37.2

-‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml&#x20;

Body: {{select raw -> copy and paste response body from Get VM’s memory information }}&#x20;

Ex:

```

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns4:Item xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns4="http://www.vmware.com/vcloud/v1.5" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf"
………………………………………………………….
……………………………………………………………
    <rasd:ResourceType>4</rasd:ResourceType>
    <rasdraidtualQuantity>2048</rasd:VirtualQuantity>
    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
type="application/vnd.vmware.vcloud.rasdItem+json"/>
</ns4:Item>
```

\==============================================================================

Tìm dòng “<mark style="color:blue;">\<rasd:VirtualQuantity>2048\</rasd:VirtualQuantity></mark>” và chỉnh sửa giá trị, đây là bộ nhớ của VM (MB). Lưu ý rằng giá trị phải là bội số của 4 MB.<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/wVQDMfBZfYsHF2kpOhCG/image.png" alt=""><figcaption></figcaption></figure>

* SEND request.
  {% endstep %}

{% step %}

#### Bước 4: Xác minh

* **Lấy thông tin bộ nhớ của VM**

GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/memory

* **Kiểm tra trên vCD portal**

Đăng nhập IAM -> vCD portal -> chọn VM -> Compute
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-cau-hinh-lai-memory-cua-vm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
