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

Cache the number of each component type assigned to devices/VMs #6347

Closed
jeremystretch opened this issue May 4, 2021 · 3 comments
Closed
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Milestone

Comments

@jeremystretch
Copy link
Member

Proposed Changes

Add the following integer fields to dcim.Device:

  • _console_port_count
  • _console_server_port_count
  • _power_port_count
  • _power_outlet_count
  • _interface_count
  • _front_port_count
  • _rear_port_count
  • _device_bay_count
  • _inventory_item_count

Add the following integer fields to virtualization.VirtualMachine:

  • _interface_count

These fields would be automatically populated upon creating/modifying/deleting the relevant child components.

Justification

  • Enables efficient filters of devices/VMs based on whether a certain type of component has been created.
  • Eliminates the need for additional queries e.g. when display the device view.
@jeremystretch jeremystretch added type: housekeeping Changes to the application which do not directly impact the end user status: under review Further discussion is needed to determine this issue's scope and/or implementation labels May 4, 2021
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels May 5, 2021
@jeremystretch jeremystretch added this to the v2.12 milestone May 5, 2021
@jeremystretch
Copy link
Member Author

This might also be a use case for CTE; see #6587.

@jeremystretch jeremystretch removed this from the v3.0 milestone Jul 8, 2021
@jeremystretch jeremystretch added needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: accepted This issue has been accepted for implementation labels Jul 8, 2021
@AndMrzv
Copy link

AndMrzv commented Apr 7, 2022

I also like to verify that devices match their device type templates (you know something's up if a 24port 1PSU switch suddenly has 29 interfaces and 3 power ports). So maybe you'll find it useful to add same data to device types, maybe expand the idea to strict matching devices to their types or syncing (now I do this with API and Bash).

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application and removed type: housekeeping Changes to the application which do not directly impact the end user labels Dec 15, 2022
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed needs milestone Awaiting prioritization for inclusion with a future NetBox release labels Jan 5, 2023
@jeremystretch jeremystretch added this to the v3.5 milestone Jan 5, 2023
@ryanmerolle ryanmerolle modified the milestones: v3.5, v3.6 Mar 23, 2023
@ryanmerolle
Copy link
Contributor

pushed to 3.6 milestone

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

4 participants