> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pcd/compute/unable-to-delete-stale-compute-service.md).

# Unable to Delete Stale Compute Service

## Problem

* Unable to delete stale compute service with the below error.

```ruby
$ openstack compute service delete  [COMPUTE_SERVICE_UUID]

Failed to delete compute service with ID '[COMPUTE_SERVICE_UUID]': HttpException: 500: Server Error for url: https://[PCD_FQDN]/nova/v2.1/[PROJECT_ID]/os-services/[COMPUTE_SERVICE_UUID], Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'ValueError'>
1 of 1 compute services failed to delete.
```

## Environment

* Private Cloud Director Virtualization - v2025.4 and Higher
* Self-Hosted Private Cloud Director Virtualization - v2025.4 and Higher
* Component: Compute Service

## Cause

* Forcefully removing a host from PCD, resulting in incomplete cleanup of resources on the management plane.

## Diagnostics

* Compute Service List:

```bash
$ openstack compute service list -c ID -c Binary -c Host -c Status -c State

+---------------------------+----------------+---------------------+---------+--------+
| ID                        | Binary         | Host                | Status   | State |
+---------------------------+----------------+---------------------+----------+-------+
| [COMPUTE_SERVICE_UUID_1]  | nova-scheduler | nova-scheduler      | enabled  | up    |
| [COMPUTE_SERVICE_UUID_2]  | nova-conductor | nova-conductor      | enabled  | up    |
| [COMPUTE_SERVICE_UUID_3]  | nova-compute   | [HOST1.EXAMPLE.COM] | enabled  | up    |
+---------------------------+----------------+---------------------+----------+-------+
```

* Resource Provider List:

```bash
$ openstack resource provider list -c uuid -c name

+--------------------------------------+---------------------+
| uuid                                 | name                |
+--------------------------------------+---------------------+
| [RESOURCE_PROVIDER_UUID_1]           | [HOST1.EXAMPLE.COM] |
| [RESOURCE_PROVIDER_UUID_2]           | [HOST2.EXAMPLE.COM] |
+--------------------------------------+---------------------+
```

* Nova API Pod Logs:
  * First grep the Nova API logs with compute service UUID and Note the Deletion Request ID.

{% code title="nova-api logs:" %}

```ruby
$ kubectl logs <NOVA_API_POD_NAME> -n <REGION_NAMESPACE> | grep <COMPUTE_SERVICE_UUID>
  
INFO nova.osapi_compute.wsgi.server [None [DELETION_REQUEST_ID] [OTHER_ID_1] [OTHER_ID_2] - - default default] [IP_ADDRESS_1],[IP_ADDRESS_2] "DELETE /v2.1/[åçPROJECT_ID]/os-services/[COMPUTE_SERVICE_UUID] HTTP/1.1" status: 500 len: 595 time: 0.1055756
```

{% endcode %}

Now grep the Nova API logs with Deletion Request ID and Note the Missing Resource Provider UUID.

{% code title="nova-api logs:" %}

```ruby
$ kubectl logs <NOVA_API_POD_NAME> -n <REGION_NAMESPACE> | grep <DELETION_REQUEST_ID>
  
Defaulted container "nova-osapi" out of: nova-osapi, socat18774, init (init)
ERROR nova.api.openstack.wsgi [None [DELETION_REQUEST_ID] [OTHER_ID_1] [OTHER_ID_2] - - default default] Unexpected exception in API method: ValueError: No such provider [MISSING_RESOURCE_PROVIDER_UUID]
INFO nova.api.openstack.wsgi [None [DELETION_REQUEST_ID] [OTHER_ID_1] [OTHER_ID_2] - - default default] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'ValueError'>
INFO nova.osapi_compute.wsgi.server [None [DELETION_REQUEST_IDD] [OTHER_ID_1] [OTHER_ID_2] - - default default] [IP_ADDRESS_1],[IP_ADDRESS_2] "DELETE /v2.1/[PROJECT_ID]/os-services/[COMPUTE_SERVICE_UUID] HTTP/1.1" status: 500 len: 595 time: 0.1055756
/var/lib/openstack/lib/python3.10/site-packages/pycadf/identifier.py:71: UserWarning: Invalid uuid: unknown. To ensure interoperability, identifiers should be a valid uuid.
```

{% endcode %}

* Based on above logs, as part of compute service deletion Nova is trying to delete the associated resource provider in Placement, but it's unable to locate it in the ProviderTree.

## Resolution

* Created a dummy Resource Provider with the same UUID that Nova is looking for during compute service deletion.

```bash
$ openstack resource provider create --uuid=<MISSING_RESOURCE_PROVIDER_UUID>  temp_provider

Expecting value: line 1 column 1 (char 0)
```

* Verify if the dummy Resource Provider with the same UUID is created.

```bash
$ openstack resource provider list -c uuid -c name

+--------------------------------------+---------------------+
| uuid                                 | name                |
+--------------------------------------+---------------------+
| [RESOURCE_PROVIDER_UUID_1]           | [HOST1.EXAMPLE.COM] |
| [RESOURCE_PROVIDER_UUID_1]           | [HOST2.EXAMPLE.COM] |
| [MISSING_RESOURCE_PROVIDER_UUID1]    | temp_provider       |
+--------------------------------------+---------------------+
```

* Now, Delete the Compute service.

```ruby
$ openstack compute service delete <COMPUTE_SERVICE_UUID>
```

## Validation

* Check the Complete Services list.

```bash
$ openstack compute service list -c ID -c Binary -c Host -c Status -c State

+---------------------------+----------------+-------------------+---------+--------+
| ID                        | Binary         | Host              | Status   | State |
+---------------------------+----------------+-------------------+----------+-------+
| [COMPUTE_SERVICE_UUID_1]  | nova-scheduler | nova-scheduler    | enabled  | up    |
| [COMPUTE_SERVICE_UUID_2]  | nova-conductor | nova-conductor    | enabled  | up    |
+---------------------------+----------------+-------------------+----------+-------+
```

## Additional Information

* Please consult our [documentation ](https://platform9.com/docs/private-cloud-director/private-cloud-director/add-hosts-Virtualized-Cluster#remove-a-host)for the recommended procedure for offboarding a host from PCD.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pcd/compute/unable-to-delete-stale-compute-service.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
