Add command to clean dead engine from service list
Add command 'service clean' to remove dead engines from service list. Closes-Bug: #1495374 Change-Id: I644eee717f8e76ab9d5d7d6847442740ea201e6b
This commit is contained in:
parent
b878014c1b
commit
d6b618be55
@ -44,6 +44,10 @@ Heat Db version
|
||||
|
||||
Shows details for all currently running heat-engines.
|
||||
|
||||
``heat-manage service clean``
|
||||
|
||||
Clean dead engine records.
|
||||
|
||||
``heat-manage --version``
|
||||
|
||||
Shows program's version number and exit. The output could be empty if
|
||||
|
@ -71,6 +71,14 @@ class ServiceManageCommand(object):
|
||||
svc['status'],
|
||||
svc['updated_at']))
|
||||
|
||||
def service_clean(self):
|
||||
ctxt = context.get_admin_context()
|
||||
for service in service_objects.Service.get_all(ctxt):
|
||||
svc = service_utils.format_service(service)
|
||||
if svc['status'] == 'down':
|
||||
service_objects.Service.delete(ctxt, svc['id'])
|
||||
print(_('Dead engines are removed.'))
|
||||
|
||||
@staticmethod
|
||||
def add_service_parsers(subparsers):
|
||||
service_parser = subparsers.add_parser('service')
|
||||
@ -78,6 +86,8 @@ class ServiceManageCommand(object):
|
||||
service_subparsers = service_parser.add_subparsers(dest='action')
|
||||
list_parser = service_subparsers.add_parser('list')
|
||||
list_parser.set_defaults(func=ServiceManageCommand().service_list)
|
||||
remove_parser = service_subparsers.add_parser('clean')
|
||||
remove_parser.set_defaults(func=ServiceManageCommand().service_clean)
|
||||
|
||||
|
||||
def purge_deleted():
|
||||
|
Loading…
x
Reference in New Issue
Block a user