Error when importing VM interfaces in bulk with interface parents #6348

Closed
opened 2025-12-29 19:39:42 +01:00 by adam · 1 comment
Owner

Originally created by @moonrail on GitHub (Apr 13, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.0

Python version

3.9

Steps to Reproduce

  1. Create two VMs, e.g. vm1 and vm2
  2. On each VM create an Interface, e.g. parent
  3. Use UI /virtualization/interfaces/import/ with the following content to create a child interface on vm1:
virtual_machine,parent,name
vm1,parent,child
  1. Submit
  2. Use UI /virtualization/interfaces/import/ with the following content to create the same child on vm2:
virtual_machine,parent,name
vm2,parent,child
  1. Submit

Expected Behavior

vm2 should have two interfaces:

  • parent
  • child, which has parent as parent

Observed Behavior

An error is returned:

Row 1 parent: "parent" is not a unique value for this field; multiple objects were found 

It seems the Queryset used for fetching the parent interface does not include the VM for narrowing down and therefore all interfaces with the searched name are returned.
As only one is expected, this leads to Django raising MultipleObjectsReturned and NetBox reraising it as forms.ValidationError.

Looks like the same error as in in #8546 that got Fixes for v3.1.9 in 6bbf168cec for dcim.interface is present for virtualization.interface.

Originally created by @moonrail on GitHub (Apr 13, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.0 ### Python version 3.9 ### Steps to Reproduce 1. Create two VMs, e.g. `vm1` and `vm2` 2. On each VM create an Interface, e.g. `parent` 3. Use UI `/virtualization/interfaces/import/` with the following content to create a child interface on `vm1`: ```csv virtual_machine,parent,name vm1,parent,child ``` 4. Submit 5. Use UI `/virtualization/interfaces/import/` with the following content to create the same child on `vm2`: ```csv virtual_machine,parent,name vm2,parent,child ``` 6. Submit ### Expected Behavior `vm2` should have two interfaces: - `parent` - `child`, which has `parent` as parent ### Observed Behavior An error is returned: ``` Row 1 parent: "parent" is not a unique value for this field; multiple objects were found ``` It seems the Queryset used for fetching the parent interface does not include the VM for narrowing down and therefore all interfaces with the searched name are returned. As only one is expected, this leads to Django raising `MultipleObjectsReturned` and NetBox reraising it as `forms.ValidationError`. Looks like the same error as in in #8546 that got Fixes for v3.1.9 in https://github.com/netbox-community/netbox/commit/6bbf168cecb338c378ef3560dee8d2840b322865 for `dcim.interface` is present for `virtualization.interface`.
adam added the type: bugstatus: accepted labels 2025-12-29 19:39:42 +01:00
adam closed this issue 2025-12-29 19:39:42 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 13, 2022):

Thanks for tying this to #8546, it's definitely the same issue.

@jeremystretch commented on GitHub (Apr 13, 2022): Thanks for tying this to #8546, it's definitely the same issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6348