Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3377: Cascade power draw calculation on all downstream power ports #4226

Closed
wants to merge 5 commits into from
Closed

Fixes #3377: Cascade power draw calculation on all downstream power ports #4226

wants to merge 5 commits into from

Conversation

hSaria
Copy link
Contributor

@hSaria hSaria commented Feb 21, 2020

Fixes: #3377

During the calculation of power draw, include all downstream power ports (i.e. non-immediate). To maintain efficiency, each power outlet caches the upstream and downstream power ports.

A power topology change will update the cached fields. The trigger for a topology change is the cable being updated/deleted (in dcim.signals).

downstream_powerports flattens what would otherwise be a recursive process during power calculation to a single query.

upstream_powerports is used as part of the power calculation to update the cached fields for any power outlet affected by the topology change.

This PR is a refactor following the extended discussion in #3916, which has more information on this topic.

@jeremystretch
Copy link
Member

Sorry this has stagnated for so long. I took a look at it, but honestly it just introduces too much logic and overhead to support a single fairly niche feature. The implementation of two new ManyToManyFields is especially concerning: We avoid M2M fields wherever possible as a rule due to the difficulties they impose on forming efficient queries. The denormalization of power outlet relationships on top of that leads me to suspect this will be a frequent source of bugs that I'm just not willing to accept at this point in time.

Given that this has been open for a few months and none of the other maintainers has expressed interest in it, I'm going to close it out. However, I suspect the overall approach conveyed in the PR is still viable to some degree, and it will serve as a reference for the eventual implementation of #3377 once it gets roadmapped. Thank you for your hard work on this, and I'm really sorry we can't move forward with it at this time.

@hSaria hSaria deleted the 3377-recursive-power branch May 7, 2020 15:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Power utilization not calculated over cascaded devices/PDU
2 participants