Force Remove the Host Role From DB for Self Hosted PCD
Problem
Unable to remove a host role from a specific host via the Platform9 UI, pcdctl
and curl
command. The UI shows a RoleUpdateConflict
error when attempting to deauthorize and decommission the host.
$ curl -s -X DELETE -H "X-Auth-Token: $token" https://<REGION_FQDN>/resmgr/v2/hosts/<HOST-UUID>/roles/image-library -vvv
...
"message":"RoleUpdateConflict: Role cannot be updated in the current state: Cannot remove role pf9-glance-role from host [Host-UUID] in the current state".
Environment
- Self-Hosted Private Cloud Director Virtualization - v2025.4 and Higher
- Self-Hosted Private Cloud Director Kubernetes - v2025.4 and Higher
Cause
The host role remained in a not-applied
state in the backend database, which blocked further updates or role removal actions through the UI. This inconsistency prevented the host from being deauthorized or decommissioned.
Diagnostics
These steps are applicable only for Self-hosted Private Cloud Director
To check the role state:
- Login into the mysqld-exporter:
$ NS=<NAMESPACE>
$ kubectl exec deploy/mysqld-exporter -c mysqld-exporter -n $NS -it -- mysql resmgr -u root -p<password>
- Check the role state:
$ mysql resmgr -e "SELECT * FROM host_role_map WHERE res_id = '<HOST_UUID>';"
+----------------+-------------+---------------+
| res_id | rolename | current_state |
+----------------+-------------+---------------+
| [HOST_UUID] | [ROLE_NAME] | not-applied |
+----------------+-------------+---------------+
The not-applied
state indicates that the role was not fully or correctly applied, resulting in a conflict when attempting UI-based role changes.
Resolution
Caution: The following steps involve direct database manipulation and should only be performed under guidance from Platform9 Support.
- Delete the role from the backend database:
$ mysql resmgr -e "DELETE FROM host_role_map WHERE res_id='<HOST_UUID>';"
- Verify that the role mapping has been removed:
$ mysql resmgr -e "SELECT * FROM host_role_map WHERE res_id = '<HOST_UUID>';"
-- Expected output: Empty set
Caution: The following steps only if need to delete the host as well.
- Optionally, delete the host from the database if needed:
$ mysql resmgr -e "DELETE FROM hosts WHERE id='<HOST_UUID>';"
- Purge PF9 packages (if host is being decommissioned):
$ sudo dpkg --purge --force-all pf9-hostagent
$ sudo dpkg --purge --force-all pf9-comms
$ sudo dpkg --purge --force-all pf9-neutron-ovn-controller
$ sudo dpkg --purge --force-all pf9-ostackhost
- Clean up PF9 services and directories:
$ sudo systemctl stop 'pf9-*.service'
$ sudo systemctl disable 'pf9-*.service'
$ sudo systemctl daemon-reexec
$ sudo systemctl daemon-reload
$ rm -rf /etc/pf9 /opt/pf9 /var/log/pf9 /var/opt/pf9
Validation
- Confirm that the role mapping associated with the host has been removed
- The host is no longer listed in the UI under Infrastructure > Hosts.
- If re-onboarding, reauthorize the host and apply roles cleanly.
- Review logs (
/var/log/pf9/hostagent.log
,/var/log/pf9/comms/
) to ensure role application is successful.