Skip to content

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

@moonrail

Description

@moonrail

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 6bbf168 for dcim.interface is present for virtualization.interface.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions