Revision cc3f266e snf-cyclades-app/synnefo/logic/management/commands/reconcile.py
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile.py | ||
---|---|---|
40 | 40 |
|
41 | 41 |
from optparse import make_option |
42 | 42 |
|
43 |
from django.conf import settings |
|
44 | 43 |
from django.core.management.base import BaseCommand, CommandError |
45 | 44 |
|
46 |
from synnefo.db.models import VirtualMachine |
|
45 |
from synnefo.db.models import VirtualMachine, Network
|
|
47 | 46 |
from synnefo.logic import reconciliation, backend, utils |
48 | 47 |
|
49 | 48 |
|
... | ... | |
239 | 238 |
vm.nics.all.delete() |
240 | 239 |
continue |
241 | 240 |
for index, nic in nics.items(): |
241 |
net_id = utils.id_from_network_name(nic['network']) |
|
242 |
subnet6 = Network.objects.get(id=net_id).subnet6 |
|
242 | 243 |
# Produce ipv6 |
243 |
ipv6 = mac2eui64(nic['mac'], settings.PUBLIC_IPV6_PREFIX)
|
|
244 |
ipv6 = subnet6 and mac2eui64(nic['mac'], subnet6) or None
|
|
244 | 245 |
nic['ipv6'] = ipv6 |
245 | 246 |
# Rename ipv4 to ip |
246 | 247 |
nic['ip'] = nic['ipv4'] |
Also available in: Unified diff