Commit 344674c6 by Szabolcs Gelencser

Hide interfaces for existing networks in add interface panel

parent 806ecf3e
......@@ -352,7 +352,9 @@ class VmAddInterfaceView(FormOperationMixin, VmOperationView):
def get_form_kwargs(self):
context = super(VmAddInterfaceView, self).get_form_kwargs()
networks = openstack_api.neutron.network_list_for_tenant(self.request, self.request.user.tenant_id)
choices = ((n.id, n.name) for n in networks)
ports = openstack_api.neutron.port_list(self.request)
instance_net_ids = [p.network_id for p in ports if p.device_id == self.object.id]
choices = [(n.id, n.name) for n in networks if n.id not in instance_net_ids]
context.update({
'choices': choices
})
......
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