mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fixes #6177: Prevent VM interface from being assigned as its own parent
This commit is contained in:
parent
c24cac9a44
commit
5bd30060e7
@ -125,6 +125,7 @@ A new provider network model has been introduced to represent the boundary of a
|
||||
* [#6171](https://github.com/netbox-community/netbox/issues/6171) - Fix display of horizontally-scrolling object lists
|
||||
* [#6173](https://github.com/netbox-community/netbox/issues/6173) - Fix assigned device/VM count when bulk editing/deleting device roles
|
||||
* [#6176](https://github.com/netbox-community/netbox/issues/6176) - Correct position of MAC address field when creating VM interfaces
|
||||
* [#6177](https://github.com/netbox-community/netbox/issues/6177) - Prevent VM interface from being assigned as its own parent
|
||||
|
||||
### Other Changes
|
||||
|
||||
|
@ -463,6 +463,10 @@ class VMInterface(PrimaryModel, BaseInterface):
|
||||
f"({self.parent.virtual_machine})."
|
||||
})
|
||||
|
||||
# An interface cannot be its own parent
|
||||
if self.pk and self.parent_id == self.pk:
|
||||
raise ValidationError({'parent': "An interface cannot be its own parent."})
|
||||
|
||||
# Validate untagged VLAN
|
||||
if self.untagged_vlan and self.untagged_vlan.site not in [self.virtual_machine.site, None]:
|
||||
raise ValidationError({
|
||||
|
Loading…
Reference in New Issue
Block a user