Revision ec22dfc4

b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py
163 163
                    backend.process_network_status(back_network, etime,
164 164
                                        0, 'OP_NETWORK_CONNECT', 'success',
165 165
                                        'Reconciliation simulated event.')
166
                    network = Network.objects.get(id=network.id)
166 167

  
167 168
            if uses_pool:
168 169
                # Reconcile IP Pools
169 170
                gnet = ganeti_networks[b][net_id]
170 171
                converter = IPPool(Foo(gnet['network']))
171 172
                a_map = bitarray_from_map(gnet['map'])
173
                a_map.invert()
172 174
                reserved = gnet['external_reservations']
173 175
                r_map = a_map.copy()
174 176
                r_map.setall(True)
......
181 183

  
182 184
        if uses_pool and (ip_available_maps or ip_reserved_maps):
183 185
            available_map = reduce(lambda x, y: x | y, ip_available_maps)
184
            available_map.invert()
185 186
            reserved_map = reduce(lambda x, y: x | y, ip_reserved_maps)
186 187

  
187 188
            pool = network.get_pool()
......
204 205
                    out.write("Synchronized pools for network %r.\n" % network.id)
205 206
            pool.save()
206 207

  
208

  
207 209
        # Detect conflicting IPs: Detect NIC's that have the same IP
208 210
        # in the same network.
209 211
        if conflicting_ips:
......
244 246
    return bitarray.bitarray(bitmap.replace("X", "1").replace(".", "0"))
245 247

  
246 248

  
247
@transaction.commit_on_success
248
def update_network_reservations(network, reservations):
249
    network.pool.reservations = reservations
250
    network.pool.save()
251

  
252 249

  
253 250
class Foo():
254 251
    def __init__(self, subnet):

Also available in: Unified diff