Block deleting compute services which are hosting instances
This change makes "DELETE /os-services/{service_id}" fail
with a 409 response when attempting to delete a nova-compute
service which is still hosting instances.
Deleting a compute service also results in deleting the
related compute_nodes table entry for that service host.
The compute node resource provider in placement is tied
to the compute node via the UUID, and if we allow deleting
the compute service and node then the resource provider for
that node is effectively orphaned in Placement, along with
the instances which have allocations against that resource
provider.
Furthermore, restarting the compute service will create a
new service and compute_nodes record, and the compute node
would have a new UUID and resource provider. This will
affect scheduling for that host since Placement will be
reporting it as having available capacity which in reality
is not accurate.
A release note is included for the (justified) behavior
change in the API. A new microversion should not be required
for this since admins should not have to opt out of broken
behavior. Since this API did not previously expect to return
a 409 response, the "expected_errors" decorator is updated
and again, should not require a microversion per the
guidelines:
Reviewed: https:/ /review. openstack. org/580496 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=8cd12048732 87d9f0196cbc48d 8c408448c67c43
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 8cd1204873287d9 f0196cbc48d8c40 8448c67c43
Author: Matt Riedemann <email address hidden>
Date: Wed Apr 11 18:00:39 2018 -0400
Block deleting compute services which are hosting instances
This change makes "DELETE /os-services/ {service_ id}" fail
with a 409 response when attempting to delete a nova-compute
service which is still hosting instances.
Deleting a compute service also results in deleting the
related compute_nodes table entry for that service host.
The compute node resource provider in placement is tied
to the compute node via the UUID, and if we allow deleting
the compute service and node then the resource provider for
that node is effectively orphaned in Placement, along with
the instances which have allocations against that resource
provider.
Furthermore, restarting the compute service will create a
new service and compute_nodes record, and the compute node
would have a new UUID and resource provider. This will
affect scheduling for that host since Placement will be
reporting it as having available capacity which in reality
is not accurate.
A release note is included for the (justified) behavior
change in the API. A new microversion should not be required
for this since admins should not have to opt out of broken
behavior. Since this API did not previously expect to return
a 409 response, the "expected_errors" decorator is updated
and again, should not require a microversion per the
guidelines:
https:/ /docs.openstack .org/nova/ latest/ contributor/ microversions. html#when- a-microversion- is-not- needed
Conflicts:
nova/ api/openstack/ compute/ services. py
NOTE(mriedem): The conflict is due to not having change 01a756448d4feb9 ca336908821f591 in Pike.
I4802c5b380
Change-Id: I0bd63b655ad3d3 d39af8d15c781ce 0a45efc8e3a 29eb9d40a8b9646 a523f6381f) b4157531b2d92b0 3a4d0ca7d1)
Closes-Bug: #1763183
(cherry picked from commit 42f62f1ed2ad768
(cherry picked from commit a817b78dc44cf2c