Commit 0e8ef222 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix bug in IP pools migration

Since the size of IP pools is not automatically computed by the size
of corresponding subnet, the data migration must add sizes to all
existing IP pools.
parent 53707dbb
......@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
import ipaddr
class Migration(DataMigration):
......@@ -18,9 +19,12 @@ class Migration(DataMigration):
dhcp=network.dhcp,
deleted=network.deleted)
ip_pool = network.pool
if ip_pool is None:
ip_pool = IPPoolTable
ip_pool.subnet = subnet
ip_pool.base = subnet.cidr
ip_pool.offset = 0
ip_pool.size = ipaddr.IPNetwork(network.subnet).numhosts
ip_pool.save()
if network.subnet6:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment