Unify Device and VirtualMachine in a single table. Differentiate between the 2 using is_virtual
flag.
#1015
slappey-ibkr
started this conversation in
Ideas
Replies: 2 comments
-
Thank you! As you suggested, this is probably an idea that makes sense to have a great deal more conversation about before making any design decisions. As such I'm going to move this issue to the Discussions for now. |
Beta Was this translation helpful? Give feedback.
0 replies
-
We're planning to move ahead with this idea in an upcoming release. As such we've moved this back to an open issue -- please refer to #1178, and please provide any comments or feedback there. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment
Proposed Functionality
Add
is_virtual
flag to Device model and deprecate VirtualMachine or make it a proxy model back to Device withis_virtual
hardcoded to True. I know there's more to it than that but I'd love to hear everyone's thoughts on this.Use Case
The problem with having 2 tables is that we must know if a host is physical or virtual when running remote jobs. Otherwise, we have to query both tables until we find the host we’re looking for. We must also know if a host is a physical or virtual when creating relations to objects such as IPAddress. The proposed functionality would unify all devices in a single table.
Database Changes
is_virtual
flag to Deviceis_virtual
hardcoded to True.is_virtual
hardcoded to False.if device.is_virtual == False:
if device.is_virtual == True:
Example Queries
device_count = Device.objects.filter(is_virtual=False).count()
vm_count = Device.objects.filter(is_virtual=True).count()
cluster = Cluster.objects.first()
cluster_devices = cluster.devices.filter(is_virtual=False)
cluster_vms = cluster.devices.filter(is_virtual=True)
External Dependencies
None
Again, I know there's more to it than this but I'd love to kick off the conversation and hear everyone's thoughts.
Beta Was this translation helpful? Give feedback.
All reactions