Revision d30f29aa snf-cyclades-app/synnefo/logic/reconciliation.py

b/snf-cyclades-app/synnefo/logic/reconciliation.py
75 75
from synnefo.util.dictconfig import dictConfig
76 76
from synnefo.util.rapi import GanetiApiError
77 77
from synnefo.logic.backend import get_ganeti_instances
78
from synnefo.logic import utils
78 79

  
79 80

  
80 81
log = logging.getLogger()
......
96 97
                        # Server is still building in Ganeti
97 98
                        continue
98 99
                    else:
99
                        new_vm = vm.client.GetInstance('%s%d' %
100
                                (settings.BACKEND_PREFIX_ID, i))
100
                        new_vm = vm.client.GetInstance(utils.id_to_instance_name(i))
101 101
                        # Server has just been created in Ganeti
102 102
                        continue
103 103
                except GanetiApiError:
......
172 172
    for i in ganeti_instances:
173 173
        if i['name'].startswith(prefix):
174 174
            try:
175
                id = int(i['name'].split(prefix)[1])
175
                id = utils.id_from_instance_name(i['name'])
176 176
            except Exception:
177 177
                log.error("Ignoring instance with malformed name %s",
178 178
                              i['name'])
......
201 201
    for i in instances:
202 202
        if i['name'].startswith(prefix):
203 203
            try:
204
                id = int(i['name'].split(prefix)[1])
204
                id = utils.id_from_instance_name(i['name'])
205 205
            except Exception:
206 206
                log.error("Ignoring instance with malformed name %s",
207 207
                              i['name'])
......
282 282
    networks = {}
283 283
    for net in backend.client.GetNetworks(bulk=True):
284 284
        if net['name'].startswith(prefix):
285
            # TODO: Get it from fun. Catch errors
286
            id = int(net['name'].split(prefix)[1])
285
            id = utils.id_from_network_name(net['name'])
287 286
            networks[id] = net
288 287

  
289 288
    return networks

Also available in: Unified diff