I'd say that it's a bad idea for several reasons. One is that you'd have to duplicate all the interfaces, and have duplicate IP addresses. Another is that there are different id spaces: i.e. /dcim/devices/123/ and /virtualization/virtualmachines/123/ are different things, and that is going to lead to confusion.
You *could* just about get away with ignoring VMs entirely, and modelling VMs as unracked "devices". In fact, this is what we had to do in the early days of Netbox, before there was VM support. it was pretty ugly.
In an ideal world, I think a Device and a VM would be two variations of the same common base object, but that's not how Netbox is designed. They are distinct objects, although they repeat many fields (e.g. role, platform), and they share Interfaces as a child object.
Is there another way to address your concerns? Devices and VMs are searchable via the same interface. Is there some sort of unified view which would be better for your use case? If you want "a single API call" could you just write a small API of your own which does two queries behind the scenes?
What that means is:
- every VM is associated with a "cluster"
- a cluster consists of zero or more devices (*)
- however you can't specify that the VM is running on *one particular device*, only on the cluster
(You could however make multiple clusters, each consisting of one device. This makes sense when you have immobile VMs, tied to the local storage on a particular server)
(*) A cluster with zero devices makes sense for a virtual cluster, e.g. nested virtualization, or for clusters in the cloud where you have no visibility of the underlying devices.