Revision 92d2d1ce snf-cyclades-app/synnefo/logic/backend.py
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
544 | 544 |
|
545 | 545 |
kw['nics'] = [{"name": nic.backend_uuid, |
546 | 546 |
"network": nic.network.backend_id, |
547 |
"ip": nic.ipv4} |
|
547 |
"ip": nic.ipv4_address}
|
|
548 | 548 |
for nic in nics] |
549 | 549 |
backend = vm.backend |
550 | 550 |
depend_jobs = [] |
551 | 551 |
for nic in nics: |
552 |
network = Network.objects.select_for_update().get(id=nic.network.id)
|
|
552 |
network = Network.objects.select_for_update().get(id=nic.network_id)
|
|
553 | 553 |
bnet, created = BackendNetwork.objects.get_or_create(backend=backend, |
554 | 554 |
network=network) |
555 | 555 |
if bnet.operstate != "ACTIVE": |
... | ... | |
714 | 714 |
"""Create a network.""" |
715 | 715 |
|
716 | 716 |
tags = network.backend_tag |
717 |
if network.dhcp: |
|
718 |
tags.append('nfdhcpd') |
|
717 |
subnet = None |
|
718 |
subnet6 = None |
|
719 |
gateway = None |
|
720 |
gateway6 = None |
|
721 |
for subnet in network.subnets.all(): |
|
722 |
if subnet.ipversion == 4: |
|
723 |
if subnet.dhcp: |
|
724 |
tags.append('nfdhcpd') |
|
725 |
subnet = subnet.cidr |
|
726 |
gateway = subnet.gateway |
|
727 |
elif subnet.ipversion == 6: |
|
728 |
subnet6 = subnet.cidr |
|
729 |
gateway6 = subnet.gateway |
|
719 | 730 |
|
720 | 731 |
if network.public: |
721 | 732 |
conflicts_check = True |
... | ... | |
728 | 739 |
# not support IPv6 only networks. To bypass this limitation, we create the |
729 | 740 |
# network with a dummy network subnet, and make Cyclades connect instances |
730 | 741 |
# to such networks, with address=None. |
731 |
subnet = network.subnet |
|
732 | 742 |
if subnet is None: |
733 | 743 |
subnet = "10.0.0.0/24" |
734 | 744 |
|
... | ... | |
742 | 752 |
with pooled_rapi_client(backend) as client: |
743 | 753 |
return client.CreateNetwork(network_name=network.backend_id, |
744 | 754 |
network=subnet, |
745 |
network6=network.subnet6,
|
|
746 |
gateway=network.gateway,
|
|
747 |
gateway6=network.gateway6,
|
|
755 |
network6=subnet6, |
|
756 |
gateway=gateway, |
|
757 |
gateway6=gateway6, |
|
748 | 758 |
mac_prefix=mac_prefix, |
749 | 759 |
conflicts_check=conflicts_check, |
750 | 760 |
tags=tags) |
Also available in: Unified diff