networks: Support virtual Ethernet (veth) devices

Closes #1767

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Add comment and a cosmetic change]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa authored and Sunil Mohan Adapa committed 2020-01-28 13:13:54 -08:00
1 parent 964051a849
commit 932d2e17f9
1 file changed
+5 -1
+5 -1
View File
@@ -43,7 +43,7 @@ class ConnectionForm(forms.Form):
"""Base form to create/edit a connection."""
name = forms.CharField(label=_('Connection Name'))
interface = forms.ChoiceField(
label=_('Physical Interface'), choices=(),
label=_('Network Interface'), choices=(),
help_text=_('The network device that this connection should be bound '
'to.'))
zone = forms.ChoiceField(
@@ -120,6 +120,10 @@ class ConnectionForm(forms.Form):
def _get_interface_choices(device_type):
"""Return a list of choices for a given device type."""
interfaces = network.get_interface_list(device_type)
# Support for virtual Ethernet devices used in containers
if device_type == nm.DeviceType.ETHERNET:
interfaces.update(network.get_interface_list(nm.DeviceType.VETH))
choices = [('', _('-- select --'))]
for interface, mac in interfaces.items():
display_string = '{interface} ({mac})'.format(