Open xarmin-dev opened 2 days ago
Seems like a good approach, clear and simple (and would address a lot of piecemeal bugs as noted). Please be sure there are adequate unit tests covering loop conditions, and if we can get some statistics on what kind of performance impact this causes that would also be a good idea.
NetBox version
v4.1.6
Feature type
Change to existing functionality
Triage priority
I volunteer to perform this work (if approved)
Proposed functionality
I am proposing an alternative solution to previously proposed recursive power calculations, that does not require database modification or Many-to-Many models, and is hopefully less complex in nature.
I recently delved into the NetBox code after using it at my MSP business for a year or so, so apologies for any incorrect nomenclature in the below.
Here is proposed simplified pseudocode, modifying the get_power_draw function:
Additionally, I propose modifying the UI to use the maximum_draw specified for the queried device in utilization calculations, rather than that of the Power Feed.
Advantages
Disadvantages
I am happy to make these changes and submit a pull request. It seems that this is a fairly common request in the community, and it would certainly help my own business as well.
Previous Issues (I am sure I missed some!)
17894
17843
5560
5559
Use case
Many environments outside of a datacenter are likely to use a PDU, connected to a UPS, connected to a Power Feed. Power is not accurately modeled in these situations, and can be confusing to users.
Allowing at least one deeper level of power calculation would allow NetBox users to more accurately determine and plan power usage across PDU, UPS, and Power Feeds.
Database changes
None
External dependencies
None