Fixes #1554: Don't require form_factor when creating an interface assigned to a virtual machine

This commit is contained in:
Jeremy Stretch
2017-10-09 14:27:31 -04:00
parent b734599f40
commit 100d979d3e
4 changed files with 15 additions and 12 deletions

View File

@@ -1303,9 +1303,9 @@ class Interface(models.Model):
raise ValidationError("An interface must belong to either a device or a virtual machine.")
# VM interfaces must be virtual
if self.virtual_machine and self.form_factor not in VIRTUAL_IFACE_TYPES:
if self.virtual_machine and self.form_factor is not IFACE_FF_VIRTUAL:
raise ValidationError({
'form_factor': "Virtual machines cannot have physical interfaces."
'form_factor': "Virtual machines can only have virtual interfaces."
})
# Virtual interfaces cannot be connected