netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Public demo: https://demo.netbox.dev
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.44k stars 2.52k forks source link

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

Open tomasz-c opened 1 year ago

tomasz-c commented 1 year ago

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:

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

cyberndj commented 1 year ago

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.
tomasz-c commented 1 year ago
  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:

ITJamie commented 1 year ago

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

abhi1693 commented 1 year ago

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

EHRETic commented 1 year ago

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?

github-actions[bot] commented 11 months ago

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.

ITJamie commented 11 months ago

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