Revision 47d1d754 snf-cyclades-app/synnefo/logic/backend_allocator.py
b/snf-cyclades-app/synnefo/logic/backend_allocator.py | ||
---|---|---|
27 | 27 |
# those of the authors and should not be interpreted as representing official |
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
|
30 |
import logging |
|
30 | 31 |
import datetime |
31 | 32 |
from django.utils import importlib |
32 | 33 |
|
... | ... | |
34 | 35 |
from synnefo.db.models import Backend |
35 | 36 |
from synnefo.logic.backend import update_resources |
36 | 37 |
|
38 |
log = logging.getLogger(__name__) |
|
39 |
|
|
37 | 40 |
|
38 | 41 |
class BackendAllocator(): |
39 | 42 |
"""Wrapper class for instance allocation. |
... | ... | |
50 | 53 |
cpu = flavor.cpu |
51 | 54 |
vm = {'ram': ram, 'disk': disk, 'cpu': cpu} |
52 | 55 |
|
56 |
log.debug("Allocating VM: %r", vm) |
|
57 |
|
|
53 | 58 |
# Refresh backends, if needed |
54 | 59 |
refresh_backends_stats() |
55 | 60 |
|
... | ... | |
63 | 68 |
# strategy |
64 | 69 |
backend = self.strategy_mod.allocate(available_backends, vm) |
65 | 70 |
|
71 |
log.info("Allocated VM %r, in backend %s", vm, backend) |
|
72 |
|
|
66 | 73 |
# Reduce the free resources of the selected backend by the size of |
67 | 74 |
# the vm |
68 | 75 |
reduce_backend_resources(backend, vm) |
... | ... | |
116 | 123 |
delta = datetime.timedelta(minutes=settings.BACKEND_REFRESH_MIN) |
117 | 124 |
for b in Backend.objects.filter(drained=False, offline=False): |
118 | 125 |
if now > b.updated + delta: |
126 |
log.debug("Updating resources of backend %r", b) |
|
119 | 127 |
update_resources(b) |
Also available in: Unified diff