Revision 54ae949d snf-app/synnefo/logic/utils.py
b/snf-app/synnefo/logic/utils.py | ||
---|---|---|
30 | 30 |
# Utility functions |
31 | 31 |
|
32 | 32 |
from synnefo.db.models import VirtualMachine |
33 |
from synnefo.logic import credits |
|
34 | 33 |
|
35 | 34 |
from django.conf import settings |
36 | 35 |
|
... | ... | |
84 | 83 |
def update_state(vm, new_operstate): |
85 | 84 |
"""Wrapper around updates of the VirtualMachine.operstate field""" |
86 | 85 |
|
87 |
# Call charge() unconditionally before any change of |
|
88 |
# internal state. |
|
89 |
credits.charge(vm) |
|
90 | 86 |
vm.operstate = new_operstate |
Also available in: Unified diff