Commit 2c2f2091 by Bach Dániel

vm: fix InterfaceTemplate.create

parent ac015c66
...@@ -307,13 +307,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -307,13 +307,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
inst.disks.add(*[disk.get_exclusive() for disk in disks]) inst.disks.add(*[disk.get_exclusive() for disk in disks])
for net in networks: for net in networks:
i = Interface.create(instance=inst, vlan=net.vlan, Interface.create(instance=inst, vlan=net.vlan,
owner=inst.owner, managed=net.managed) owner=inst.owner, managed=net.managed)
port, proto = ACCESS_PROTOCOLS[i.instance.access_method][1:3]
# TODO fix this port fw, private=port)
inst.req_traits.add(*req_traits) inst.req_traits.add(*req_traits)
inst.tags.add(*tags) inst.tags.add(*tags)
...@@ -121,6 +121,10 @@ class Interface(Model): ...@@ -121,6 +121,10 @@ class Interface(Model):
host.pub_ipv4 = vlan.snat_ip host.pub_ipv4 = vlan.snat_ip
host.full_clean() host.full_clean()
from .instance import ACCESS_PROTOCOLS
port, proto = ACCESS_PROTOCOLS[instance.access_method][1:3]
host.add_port(proto, private=port)
else: else:
host = None host = None
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 sign in to comment