Detach Network Interface from VM
DELETE
/v2.1/{project_id}/servers/{server_id}/os-interface/{port_id}Detaches a network interface from a VM. By default the port is deleted with the interface; keep that in mind if a floating IP or a security group is bound to the port.
info
Source: detach-interface
Request
Parameters
project_idstringrequiredThe UUID of the project.
server_idstringrequiredThe UUID of the VM.
port_idstringrequiredThe ID of the port to detach. Get it from List VM Network Interfaces.
Sample Request
curl -ks -X DELETE -H 'Content-Type: application/json' -H 'X-OpenStack-Nova-API-Version: 2.67' \
-H 'X-Auth-Token: gAAAAA<...>' \
https://api.vietnix.cloud:8774/v2.1/{project_id}/servers/{server_id}/os-interface/{port_id}
Response
Status Code
Success
| Status Code | Description |
|---|---|
| 202 - Accepted | The detach was accepted and is being processed. |
Error
| Status Code | Description |
|---|---|
| 401 - Unauthorized | User must authenticate before making a request. |
| 403 - Forbidden | Policy does not allow current user to do this operation. |
| 404 - Not Found | The VM or the port does not exist, or the port is not attached to this VM. |
| 409 - Conflict | The VM is in a status that does not allow detaching. |
| 501 - Not Implemented | Network interfaces are not implemented for this deployment. |
warning
Detaching the only interface of a VM cuts all of its network access, including SSH and the floating IP association. Make sure you still have console access before you do it.