Possibility to assign virtual machines (containers) directly to devices. #7781

Open
opened 2025-12-29 20:28:07 +01:00 by adam · 8 comments
Owner

Originally created by @tomasz-c on GitHub (Mar 21, 2023).

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:
image

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

Originally created by @tomasz-c on GitHub (Mar 21, 2023). ### 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: ![image](https://user-images.githubusercontent.com/12180991/226622409-0c69ea72-8dde-475a-88b2-d3c73afd474f.png) 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
adam added the type: featurenetboxneeds milestonestatus: backlogcomplexity: high labels 2025-12-29 20:28:07 +01:00
Author
Owner

@cyberndj commented on GitHub (Mar 21, 2023):

Howdy, some thoughts:

  1. VM's can run as a standalone on a single host (VirtualBox, VMware Player, etc) without a cluster.
  2. I can see this starting to expand into getting containers added (LXC, Docker, Kubernetes, etc) to NetBox Virtualization section. (Totally cool IMO)
  3. Quickfix would be to remove the cluster requirement, long term might be point 2.
  4. 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.
@cyberndj commented on GitHub (Mar 21, 2023): Howdy, some thoughts: 1. VM's can run as a standalone on a single host (VirtualBox, VMware Player, etc) without a cluster. 2. I can see this starting to expand into getting containers added (LXC, Docker, Kubernetes, etc) to NetBox Virtualization section. (Totally cool IMO) 3. Quickfix would be to remove the cluster requirement, long term might be point 2. 4. 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.
Author
Owner

@tomasz-c commented on GitHub (Mar 22, 2023):

  1. 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
@tomasz-c commented on GitHub (Mar 22, 2023): > 4. 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
Author
Owner

@ITJamie commented on GitHub (Mar 29, 2023):

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

@ITJamie commented on GitHub (Mar 29, 2023): 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
Author
Owner

@abhi1693 commented on GitHub (Mar 29, 2023):

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

@abhi1693 commented on GitHub (Mar 29, 2023): 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
Author
Owner

@EHRETic commented on GitHub (May 5, 2023):

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?

@EHRETic commented on GitHub (May 5, 2023): > 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?
Author
Owner

@github-actions[bot] commented on GitHub (Aug 4, 2023):

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.

@github-actions[bot] commented on GitHub (Aug 4, 2023): 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](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@ITJamie commented on GitHub (Aug 7, 2023):

I am willing to volunteer to make this change (if approved by core maintainers)

@ITJamie commented on GitHub (Aug 7, 2023): I am willing to volunteer to make this change (if approved by core maintainers)
Author
Owner

@mirceaulinic commented on GitHub (Nov 26, 2025):

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.

@mirceaulinic commented on GitHub (Nov 26, 2025): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7781