Enforcing site consistency between PowerFeed and PowerPanel #4403

Closed
opened 2025-12-29 18:35:40 +01:00 by adam · 2 comments
Owner

Originally created by @candlerb on GitHub (Dec 23, 2020).

Environment

  • Python version: 3.6.9
  • NetBox version: 2.10.2

Overview

A PowerPanel is associated with a site and a nullable RackGroup.

A PowerFeed is associated with a parent PowerPanel and a nullable Rack (but not a site, since that's implied from the PowerPanel).

      ,----------------------<
      |                   ,--< panel P1------.
      |                  +                   ^
site S1 ---< rackgroup G1                  feed F1
      |                  +                   v
      |                   `--< rack R1 +-----'
       `---------------------<

The UI currently enforces that when you create a new PowerFeed, if you set a Rack it must be in the same site as its parent PowerPanel (although it doesn't have to be in the same RackGroup)

Arguably this isn't a database consistency check, but a policy constraint: "If a PowerFeed has a Rack, then that Rack must be in the same site as the PowerPanel". However, it's possible to violate this policy by updating items in a specific sequence.

Steps to Reproduce

Variation 1:

  1. Create sites A and B
  2. Create rack R in site A
  3. Create PowerPanel P in site A
  4. Create PowerFeed F belonging to PowerPanel P and rack R
  5. Change P to be in site B

At this point, PowerFeed F is in a rack in site A, but its PowerPanel is in site B.

Variation 2: as variation 1, but

  • also create RackGroup G in site A, and set PowerPanel P to be in RackGroup G (but leave Rack R not assigned to any RackGroup)
  • in the last step, change RackGroup G to be in site B

With recent changes for #5311 this should change the PowerPanel to be in site B, but the PowerFeed is still in a Rack in site A

Variation 3: as variation 1, but

  • at last step, change rack R from site A to site B

Variation 4: as variation 3, but rack R is in its own rackgroup (G2) and as last step you move G2 from one site to another.

Expected Behavior

In variations 1 and 2: either the change should be rejected, or all PowerFeeds which belong to this PowerPanel should have their rack set to 'None'
In variations 3 and 4: either the change should be rejected, or all PowerFeeds which refer to this Rack should have their rack set to 'None'

Observed Behavior

PowerFeed is in a rack which is in a different site than its associated PowerPanel.

Originally created by @candlerb on GitHub (Dec 23, 2020). ### Environment * Python version: 3.6.9 * NetBox version: 2.10.2 ### Overview A PowerPanel is associated with a site and a nullable RackGroup. A PowerFeed is associated with a parent PowerPanel and a nullable Rack (but not a site, since that's implied from the PowerPanel). ``` ,----------------------< | ,--< panel P1------. | + ^ site S1 ---< rackgroup G1 feed F1 | + v | `--< rack R1 +-----' `---------------------< ``` The UI currently enforces that when you create a new PowerFeed, if you set a Rack it must be in the same site as its parent PowerPanel (although it doesn't have to be in the same RackGroup) Arguably this isn't a database consistency check, but a policy constraint: "If a PowerFeed has a Rack, then that Rack must be in the same site as the PowerPanel". However, it's possible to violate this policy by updating items in a specific sequence. ### Steps to Reproduce Variation 1: 1. Create sites A and B 2. Create rack R in site A 3. Create PowerPanel P in site A 4. Create PowerFeed F belonging to PowerPanel P and rack R 5. Change P to be in site B At this point, PowerFeed F is in a rack in site A, but its PowerPanel is in site B. Variation 2: as variation 1, but * also create RackGroup G in site A, and set PowerPanel P to be in RackGroup G (but leave Rack R *not* assigned to any RackGroup) * in the last step, change RackGroup G to be in site B With recent changes for #5311 this should change the PowerPanel to be in site B, but the PowerFeed is still in a Rack in site A Variation 3: as variation 1, but * at last step, change rack R from site A to site B Variation 4: as variation 3, but rack R is in its own rackgroup (G2) and as last step you move G2 from one site to another. ### Expected Behavior In variations 1 and 2: either the change should be rejected, or all PowerFeeds which belong to this PowerPanel should have their rack set to 'None' In variations 3 and 4: either the change should be rejected, or all PowerFeeds which refer to this Rack should have their rack set to 'None' ### Observed Behavior PowerFeed is in a rack which is in a different site than its associated PowerPanel.
adam added the status: needs ownerpending closuretype: housekeeping labels 2025-12-29 18:35:40 +01:00
adam closed this issue 2025-12-29 18:35:40 +01:00
Author
Owner

@stale[bot] commented on GitHub (Feb 22, 2021):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@stale[bot] commented on GitHub (Feb 22, 2021): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@stale[bot] commented on GitHub (Mar 19, 2021):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@stale[bot] commented on GitHub (Mar 19, 2021): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4403