Commit b566ae91 by Kálmán Viktor

dashboard: better filtering of stopped vms

parent 1ea1f78b
...@@ -23,12 +23,11 @@ class IndexView(TemplateView): ...@@ -23,12 +23,11 @@ class IndexView(TemplateView):
'more_instances': instances.count() - len(instances[:5]) 'more_instances': instances.count() - len(instances[:5])
}) })
stopped_vm_states = ['PAUSED', 'SHUTDOWN', 'SHUTOFF']
context.update({ context.update({
'running_vms': instances.filter(state='RUNNING'), 'running_vms': instances.filter(state='RUNNING'),
'running_vm_num': instances.filter(state='RUNNING').count(), 'running_vm_num': instances.filter(state='RUNNING').count(),
'stopped_vm_num': instances.filter( 'stopped_vm_num': instances.exclude(
state__in=stopped_vm_states).count() state__in=['RUNNING', 'NOSTATE']).count()
}) })
return context return context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment