ForceDelete Instance

If nova config 'reclaim_instance_interval', a instance will be
soft-deleted, that will cause a error, that volumes or other attached with the
instance will cann't be deleted for its 'in-use' status.
Now force_delete the instance, the error no longer occurs.

Closes-Bug: #1564265
Change-Id: I4d1dd33b23d5882481f4d2c06107c3fb8c08cb93
This commit is contained in:
Huangsm 2017-04-07 21:51:08 -04:00
parent 121627bce7
commit fedba4dddf
3 changed files with 16 additions and 2 deletions

View File

@ -445,9 +445,12 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
return False
status = self.get_status(server)
if status in ("DELETED", "SOFT_DELETED"):
if status == 'DELETED':
return True
if status == 'ERROR':
if status == 'SOFT_DELETED':
self.client().servers.force_delete(server_id)
elif status == 'ERROR':
fault = getattr(server, 'fault', {})
message = fault.get('message', 'Unknown')
code = fault.get('code')

View File

@ -287,6 +287,8 @@ class FakeSessionClient(base_client.SessionClient):
assert set(body[action].keys()) == set(['host',
'block_migration',
'disk_over_commit'])
elif action == 'forceDelete':
assert body is not None
else:
raise AssertionError("Unexpected server action: %s" % action)
return (resp, _body)

View File

@ -0,0 +1,9 @@
---
fixes:
- Force delete the nova instance.
If a resource is related with a nova instance which
is in 'SOFT_DELETED' status, the resource can't be
deleted, when nova config 'reclaim_instance_interval'.
so, force-delete the nova instance, and then all the
resources are related with the instance would be
processed properly.