root / db / charger.py @ 452d2391
History | View | Annotate | Download (572 Bytes)
1 |
#
|
---|---|
2 |
# Charger - Administration script
|
3 |
#
|
4 |
# Executed hourly to charge vm usage for each user
|
5 |
#
|
6 |
# Copyright 2010 Greek Research and Technology Network
|
7 |
#
|
8 |
|
9 |
from db.models import * |
10 |
|
11 |
|
12 |
def periodically_charge(): |
13 |
"""Scan all virtual machines and charge each user"""
|
14 |
all_vms = VirtualMachine.objects.all() |
15 |
|
16 |
if len(all_vms) == 0: |
17 |
print "No virtual machines found" |
18 |
return
|
19 |
|
20 |
for vm in all_vms: |
21 |
# Running and Stopped is charged, else the cost is zero
|
22 |
# FIXME: not implemented!
|
23 |
vm.charge() |
24 |
|
25 |
# vim: set ts=4 sts=4 sw=4 et ai :
|