How to Force Remove offline host from PCD Using API call?
Problem
API-driven forced removal of an offline host in PCD.
Environment
- Private Cloud Director - v2025.4 and Higher
- Self-Hosted Private Cloud Director Virtualization – v2025.4 and Higher
Procedure
- Obtain an API token using the OpenStack CLI:
$ openstack token issue -f value -c id
- Identify the Host ID of the offline host from the UI or using below api call:
$ curl -X GET \
-H "X-Auth-Token: <TOKEN_ID>" \
"https://<PCD_FQDN>/resmgr/v2/hosts" \
| jq '[.[] | {id, hostname: .info.hostname, responding: .info.responding}]'
Sample Output:
$ curl -s -X GET \
-H "X-Auth-Token: <TOKEN_ID>" \
"https://example-region1.app.pcd.platform9.com/resmgr/v2/hosts" \
| jq '[.[] | {id, hostname: .info.hostname, responding: .info.responding}]'
[
{
"id": "[HOST_ID_1]",
"hostname": "[HOST_NAME_1]",
"responding": true
},
{
"id": "[HOST_ID_2]",
"hostname": "[HOST_NAME_2]",
"responding": false
},
]
- Force Remove the Host:
The DELETE API operation can be perfomed by Admin users only.
Also invoke the DELETE API for hosts that are already offline or permanently unrecoverable and have no VMs or images tied to them. Deleting a live host can create system inconsistencies—placing it in a limbo deauthorized
state, causing it to re‑appear in inventory, corrupting metadata, or triggering erratic resource behavior.
For active hosts, use deauthorize
and decommission
operations instead to ensure safe and consistent removal.
$ curl -X DELETE \
-H "X-Auth-Token: <TOKEN_ID>" \
"https://<PCD_FQDN>/resmgr/v2/hosts/<HOST_ID_2>"
- Once the Host is removed, the associated compute service and network agents must be deleted.
- Note the ID of compute service and network agents.
- Delete the compute service and network agents associated to Host.
Delete all the network agents configured for the affected host in this case <HOST_ID_2> , listed in the output of command openstack network agent list -c ID -c Agent_Type -c Host | grep <HOST_ID_2>
# Note the ID of service/agents
$ openstack compute service list -c ID -c Binary -c Host | grep <HOST_ID_2>
| [COMPUTE_SERVICE_ID] | nova-compute | [HOST_ID_2]
$ openstack network agent list -c ID -c Agent_Type -c Host | grep <HOST_ID_2>
| [NETWORK_METADATA_AGENT_ID] | OVN Metadata agent | [HOST_ID_2] |
| [NETWORK_CONTROLLER_AGENT_ID] | OVN Controller Gateway agent | [HOST_ID_2] |
.....
# Delete the service/agents associated to Host
$ openstack compute service delete <COMPUTE_SERVICE_ID>
$ openstack network agent delete <NETWORK_METADATA_AGENT_ID>
$ openstack network agent delete <NETWORK_CONTROLLER_AGENT_ID>