available_power in dcim/models.py in class PowerFeed is too small. #3025

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

Originally created by @ThomasADavis on GitHub (Nov 22, 2019).

Environment

  • Python version: python3.6
  • NetBox version: v2.6.6

Steps to Reproduce

  1. Create a power feed.
  2. in that power feed, set Voltage to 480, current to 100A.
  3. get django db error.
<class 'django.db.utils.DataError'>

smallint out of range

480*100 = 48000 which is greater than 32767; so the available_power field is too small. (we have racks with much more power coming next year - try 480v at 150A time 3!)

Change available_power from PositiveSmallIntegerField to PositiveIntegerField which moves it to a range of 0 2,147,483,647 (2TW of power!)

Both values voltage and current fields are under the PositiveSmallIntegerField values, but, the available_power is greater than what the field is defined as.

Originally created by @ThomasADavis on GitHub (Nov 22, 2019). ### Environment * Python version: python3.6 * NetBox version: v2.6.6 ### Steps to Reproduce 1. Create a power feed. 2. in that power feed, set Voltage to 480, current to 100A. 3. get django db error. ``` <class 'django.db.utils.DataError'> smallint out of range ``` 480*100 = 48000 which is greater than 32767; so the available_power field is too small. (we have racks with much more power coming next year - try 480v at 150A time 3!) Change available_power from PositiveSmallIntegerField to PositiveIntegerField which moves it to a range of 0 2,147,483,647 (2TW of power!) Both values voltage and current fields are under the PositiveSmallIntegerField values, but, the available_power is greater than what the field is defined as.
adam added the status: acceptedtype: feature labels 2025-12-29 18:24:53 +01:00
adam closed this issue 2025-12-29 18:24:53 +01:00
Author
Owner

@ThomasADavis commented on GitHub (Nov 22, 2019):

I have also found this:

[root@netbox dcim]# grep -i watt *py
forms.py:        help_text="Maximum current draw (watts)"
forms.py:        help_text="Allocated current draw (watts)"
models.py:        help_text="Maximum current draw (watts)"
models.py:        help_text="Allocated current draw (watts)"
models.py:        help_text="Maximum current draw (watts)"
models.py:        help_text="Allocated current draw (watts)"

current is not measured in watts.. so is these fields power, or current?

Should it be "Allocated power draw (watts)", and if it is power, then the field should also be changed from a PositiveSmallIntegerField to PositiveIntegerField (racks are getting denser, and with water cooling.. really high power numbers)

and my experience to date is rack PDU strips are rated at voltage*amps (ie, feed breaker), not watts; that way I can also track 480/208/110 devices and breaker sizing..

@ThomasADavis commented on GitHub (Nov 22, 2019): I have also found this: ``` [root@netbox dcim]# grep -i watt *py forms.py: help_text="Maximum current draw (watts)" forms.py: help_text="Allocated current draw (watts)" models.py: help_text="Maximum current draw (watts)" models.py: help_text="Allocated current draw (watts)" models.py: help_text="Maximum current draw (watts)" models.py: help_text="Allocated current draw (watts)" ``` current is not measured in watts.. so is these fields power, or current? Should it be "Allocated power draw (watts)", and if it is power, then the field should also be changed from a PositiveSmallIntegerField to PositiveIntegerField (racks are getting denser, and with water cooling.. really high power numbers) and my experience to date is rack PDU strips are rated at voltage*amps (ie, feed breaker), not watts; that way I can also track 480/208/110 devices and breaker sizing..
Author
Owner

@DanSheps commented on GitHub (Nov 22, 2019):

Database Changes

Require migration:

  • Change available_power to PostiveIntegerField

External Dependencies

None

@DanSheps commented on GitHub (Nov 22, 2019): ### Database Changes Require migration: * Change available_power to PostiveIntegerField ### External Dependencies None
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3025