Possibility to assign virtual machines (containers) directly to devices.
NetBox version
v3.4.6
Feature type
Change to existing functionality
Proposed functionality
I am submitting for consideration the idea of enabling the assignment of virtual machines (rather in the sense of containers) directly to devices.
Currently, if you want to assign a VM to a device it is necessary to create a cluster and assign that device to it. When trying to add a VM to a device without specifying a cluster, an error is displayed:

If I want to bypass this by adding multiple devices to a cluster, it results in the fact that I cannot have two VMs with the same name in a given cluster, one active and the other offline. In the use cases I am dealing with, this situation occurs.
In short, the above would only require:
- allowing a virtual machine to be assigned to a device without being assigned to a cluster,
- checking the uniqueness of virtual machine names within a single device,
Use case
In the case where I'm dealing with containers (e.g. LXC or Docker), the cluster is a single device so it would be very practical to allow such a direct assignment of a virtual machine to a device and to keep an eye on the uniqueness of the virtual machine's name only within the device, so that on another device it can be of the same name in a different strangeness (offline, planned, etc.).
In cases where containers are used on devices and migrated frequently, it is useful to have information that a container is offline on another device.
I hope it would be useful not only for me. Maybe someone else will comment on whether they use Netbox in such use cases?
Database changes
Probably none, unless a foreign key in some table?
External dependencies
None
Howdy, some thoughts:
- VM's can run as a standalone on a single host (VirtualBox, VMware Player, etc) without a cluster.
- I can see this starting to expand into getting containers added (LXC, Docker, Kubernetes, etc) to NetBox Virtualization section. (Totally cool IMO)
- Quickfix would be to remove the cluster requirement, long term might be point 2.
- My suggested work around would be to create a cluster with the same name as the device, then you can assign the "VM" to the cluster and host.
- My suggested work around would be to create a cluster with the same name as the device, then you can assign the "VM" to the cluster and host.
I have been considering this as a temporary solution, but it has several disadvantages:
- you have to create an unnecessary cluster (because it will consist of only one device)
- you need to assign this device to this cluster in order to assign the VM to the device, unless you give up on this and leave only the assignment to the cluster name, but then from the device you will not see its containers (because the cluster will not be associated with the device)
- when you remove a device, you need to remember to remove the cluster with the same name so as not to leave a mess
related previous convo where it was made possible to assign to a specific device in a cluster: https://github.com/netbox-community/netbox/issues/8222
previously asked for : https://github.com/netbox-community/netbox/issues/4482
This would be helpful for us too. We have some standalone ESXi servers which have multiple VMs. Currently, we have to create a dummy cluster just to add this info to netbox but there is no cluster in reality which causes confusion among users.
Having the ability to directly assign the VM to a device will help with that
2. I can see this starting to expand into getting containers added (LXC, Docker, Kubernetes, etc) to NetBox Virtualization section. (Totally cool IMO)
I would definitively need that, I just started with docker in my environement and I use a dedicated subnet with macvlan/IPs and I would like to register my containers in Netbox AS containers, not VMs 😉
Should we request this separatelly?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
I am willing to volunteer to make this change (if approved by core maintainers)
As an extension to this, it'd be great if the view would be replicated on the device side. Specifically, when I look at a server, I'd love to know what VMs are deployed there.