Revision 2e1e6844 snf-cyclades-app/synnefo/logic/backend_allocator.py

b/snf-cyclades-app/synnefo/logic/backend_allocator.py
32 32
from django.utils import importlib
33 33

  
34 34
from synnefo.settings import (BACKEND_ALLOCATOR_MODULE, BACKEND_REFRESH_MIN,
35
                              BACKEND_PER_USER)
35
                              BACKEND_PER_USER, ARCHIPELAGOS_BACKENDS)
36 36
from synnefo.db.models import Backend
37 37
from synnefo.logic.backend import update_resources
38 38
from synnefo.api.util import backend_public_networks
......
73 73
        # Get available backends
74 74
        available_backends = get_available_backends()
75 75

  
76
        # Temporary fix for distinquishing archipelagos capable backends
77
        available_backends = filter_archipelagos_backends(available_backends,
78
                                                          flavor.disk_template)
76 79
        # Refresh backends, if needed
77 80
        refresh_backends_stats(available_backends)
78 81

  
......
101 104
    return filter(lambda x: has_free_ip(x), backends)
102 105

  
103 106

  
107
def filter_archipelagos_backends(available_backends, disk_template):
108
    if disk_template.startswith("ext_"):
109
        available_backends = filter(lambda x: x.id in ARCHIPELAGOS_BACKENDS,
110
                                    available_backends)
111
    else:
112
        available_backends = filter(lambda x: x.id not in ARCHIPELAGOS_BACKENDS,
113
                                    available_backends)
114
    return available_backends
115

  
116

  
104 117
def has_free_ip(backend):
105 118
    """Find if Backend has any free public IP."""
106 119
    for network in backend_public_networks(backend):

Also available in: Unified diff