mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 07:56:44 -06:00
Closes #12135: Prevent the deletion of interfaces with children
This commit is contained in:
parent
7efbfabc0b
commit
aeea7e0d43
@ -77,6 +77,9 @@ If selected, this component will be treated as if a cable has been connected.
|
||||
|
||||
Virtual interfaces can be bound to a physical parent interface. This is helpful for modeling virtual interfaces which employ encapsulation on a physical interface, such as an 802.1Q VLAN-tagged subinterface.
|
||||
|
||||
!!! note
|
||||
An interface with one or more child interfaces assigned cannot be deleted until all its child interfaces have been deleted or reassigned.
|
||||
|
||||
### Bridged Interface
|
||||
|
||||
Interfaces can be bridged to other interfaces on a device in two manners: symmetric or grouped.
|
||||
|
@ -16,6 +16,9 @@ The interface's name. Must be unique to the assigned VM.
|
||||
|
||||
Identifies the parent interface of a subinterface (e.g. used to employ encapsulation).
|
||||
|
||||
!!! note
|
||||
An interface with one or more child interfaces assigned cannot be deleted until all its child interfaces have been deleted or reassigned.
|
||||
|
||||
### Bridged Interface
|
||||
|
||||
An interface on the same VM with which this interface is bridged.
|
||||
|
19
netbox/dcim/migrations/0182_protect_child_interfaces.py
Normal file
19
netbox/dcim/migrations/0182_protect_child_interfaces.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 4.2.6 on 2023-10-20 11:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dcim', '0181_rename_device_role_device_role'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='interface',
|
||||
name='parent',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='child_interfaces', to='dcim.interface'),
|
||||
),
|
||||
]
|
@ -537,7 +537,7 @@ class BaseInterface(models.Model):
|
||||
)
|
||||
parent = models.ForeignKey(
|
||||
to='self',
|
||||
on_delete=models.SET_NULL,
|
||||
on_delete=models.PROTECT,
|
||||
related_name='child_interfaces',
|
||||
null=True,
|
||||
blank=True,
|
||||
|
@ -0,0 +1,19 @@
|
||||
# Generated by Django 4.2.6 on 2023-10-20 11:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('virtualization', '0036_virtualmachine_config_template'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='vminterface',
|
||||
name='parent',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='child_interfaces', to='virtualization.vminterface'),
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue
Block a user