Liệt kê network interface của VM
GET
/v2.1/{project_id}/servers/{server_id}/os-interfaceLiệt kê các port gắn với VM: port ID, network và subnet, fixed IP, địa chỉ MAC và trạng thái port. Dùng port ID khi cần detach interface hoặc tìm port đứng sau một floating IP.
info
Nguồn: list-port-interfaces
Request
Tham số
project_idstringbắt buộcUUID của project.
server_idstringbắt buộcUUID của VM.
Request mẫu
curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
https://api.vietnix.cloud:8774/v2.1/{project_id}/servers/{server_id}/os-interface
Response
interfaceAttachmentsarraybắt buộcDanh sách interface attachment.
port_idstringbắt buộcPort ID.
net_idstringbắt buộcNetwork ID.
fixed_ipsarraybắt buộcCác địa chỉ fixed IP kèm subnet ID.
2 trường
subnet_idstringbắt buộcbodyUUID của subnet.
ip_addressstringbắt buộcbodyĐịa chỉ IP.
mac_addrstringbắt buộcĐịa chỉ MAC.
port_statestringbắt buộcTrạng thái port, ví dụ ACTIVE.
tagstringbắt buộcTag device gán cho interface, hoặc null.
Response mẫu
Response body
{
"interfaceAttachments": [
{
"port_state": "ACTIVE",
"fixed_ips": [
{
"subnet_id": "d52aa9f4-6a4b-4268-a71d-1a50f9b60aa9",
"ip_address": "10.136.18.138"
}
],
"port_id": "bfc3228d-384e-4864-a583-54157225a4ef",
"net_id": "a1d8d6ae-c89d-4307-8a0c-3cc2ee55d7e3",
"mac_addr": "fa:16:3e:3b:0b:c3"
}
]
}
Mã trạng thái
Thành công
| Mã | Mô tả |
|---|---|
| 200 - OK | Request thành công. |
Lỗi
| Mã | Mô tả |
|---|---|
| 401 - Unauthorized | User phải xác thực trước khi gửi request. |
| 403 - Forbidden | Policy không cho phép user hiện tại thực hiện thao tác này. |
| 404 - Not Found | VM không tồn tại, hoặc không hiển thị với project của bạn. |
| 501 - Not Implemented | Network interface không được hỗ trợ trong deployment này. |
note
Một VM có thể có nhiều interface trên cùng một network. Không nhận diện interface chỉ bằng IP; hãy dùng port_id.