Fix compute host delete with no kubernetes node
When a compute host is deleted, the VIM attempts to delete the node from kubernetes. However, if a compute host was powered on and the personality was set, but the host was never installed, no kubernetes node will exist for the host. When the VIM attempts to delete the node from kubernetes, the API returns a failure and the VIM doesn't handle that properly, so it continues to attempt to delete the node over and over. The fix is to handle the NOT_FOUND response from the delete API and treat that as a success. Change-Id: If9ca8baae4252a46ed7a514b2e91586436262688 Story: 2002843 Task: 29496 Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
This commit is contained in:
parent
2f1b243350
commit
2612aa7e65
@ -119,6 +119,18 @@ def delete_node(node_name):
|
||||
|
||||
# Delete the node
|
||||
body = kubernetes.client.V1DeleteOptions()
|
||||
response = kube_client.delete_node(node_name, body)
|
||||
|
||||
try:
|
||||
response = kube_client.delete_node(node_name, body)
|
||||
except ApiException as e:
|
||||
if e.status == httplib.NOT_FOUND:
|
||||
# In some cases we may attempt to delete a node that exists in
|
||||
# the VIM, but not yet in kubernetes (e.g. when the node is first
|
||||
# being configured). Ignore the failure.
|
||||
DLOG.info("Not deleting node %s because it doesn't exist" %
|
||||
node_name)
|
||||
return
|
||||
else:
|
||||
raise
|
||||
|
||||
return Result(response)
|
||||
|
Loading…
x
Reference in New Issue
Block a user