netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.92k stars 2.56k forks source link

Unable to add Virtual Machine to Cluster with Site assigned #16796

Closed rodvand closed 3 months ago

rodvand commented 3 months ago

Deployment Type

Self-hosted

NetBox Version

v4.0.6

Python Version

3.10

Steps to Reproduce

  1. Create a site Site1
  2. Create a cluster Cluster1 and assign it to a site (Cluster type can be whatever)
  3. Create a virtual machine and assign it to Cluster1

Expected Behavior

The virtual machine to be created without issues and be assigned to Cluster1.

Observed Behavior

An error is returned: "The selected cluster (Cluster1) is not assigned to this site (None)."

I suspect this is a regression from https://github.com/netbox-community/netbox/pull/15763

rodvand commented 3 months ago

So the VM creation works if you define both the Site and Cluster in the process. However I feel this should not be needed as you assign a site to a cluster for a reason. The change also breaks any automation which doesn't currently define a site and cluster.

(I just noticed due to failing tests in the ansible collection).

jeffgdotorg commented 3 months ago

Hi @rodvand, thanks for reporting this problem you've encountered in NetBox.

I have a hunch you're describing the same fundamental problem as captured in #15310 which I helped triage some weeks ago. Would you please take a look at that issue and join it if my hunch is correct? Otherwise please set me straight on the distinction and we'll move forward here.

rodvand commented 3 months ago

I have a hunch you're describing the same fundamental problem as captured in #15310 which I helped triage some weeks ago. Would you please take a look at that issue and join it if my hunch is correct? Otherwise please set me straight on the distinction and we'll move forward here.

The issue I'm describing only appeared in 4.0.6, so I don't think it's the same issue. I think my issue is just a bit of a logic error in the PR I linked in the initial report.