netbox-sync icon indicating copy to clipboard operation
netbox-sync copied to clipboard

[FR] Tenant relation based on resource pool or parent folder tag in vCenter

Open Hidden-Network404 opened this issue 7 months ago • 5 comments

Hi!

Currently, to define VM tenants in settings.ini we can only use vm_tenant_relation which would mean that you'd need to have some kind of common naming convention for each tenant or typing all VMs there.

Would it be possible to extent that functionality to define VM tenant based on tag of the parent folder it's located in vCenter or based on the resource pool? Our use case is that we separated departments and allocated each resource pool and folder, and they don't always follow suggested naming conventions unfortunately

Hidden-Network404 avatar Jun 12 '25 16:06 Hidden-Network404

Hi,

pretty sure this could be implemented. What would you suggest how the tenant name would be parsed from a tag?

bb-Ricardo avatar Jun 16 '25 07:06 bb-Ricardo

I was thinking about 2 options, but I'm not sure if folder relation is easy to implement. But with tag vSphere SDK should be able to pull tags from the parent folder in vCenter, and then parse tags and find those hardcoded tenant to tag relation?

Option 1: Direct folder-to-tenant mapping

vm_tenant_folder_relation = Department-A = Tenant-A, Department-B = Tenant-B

Option 2: Folder tag-based mapping

vm_tenant_folder_tag_relation = dept:finance = Finance-Tenant, dept:engineering = Engineering-Tenant

Hidden-Network404 avatar Jun 17 '25 17:06 Hidden-Network404

Hi,

tags are already extracted from vCenter and added to VMs and Devices if desired. The issue here is to find a format of mapping a certain tag to a Tenant.

but maybe we could do following:

  • first add tags to a VM with the existing options: https://github.com/bb-Ricardo/netbox-sync/blob/2e4c0f316361c497d2c77bc5f6661df26acc77d3/settings-example.ini#L309
  • then use another config option which defines a regex for the tag to extract the tenant name.
  • try to find extracted tenant and if tenant is found, add it to the VM

This could work and the user could freely define the tag format

bb-Ricardo avatar Jun 18 '25 09:06 bb-Ricardo

Hi was there any progress on this ?

we have multi-tenant vCenter setups that have each customer under their own resourcepool. Perhaps a resourcepool to tenant name relation?

xonacs avatar Nov 05 '25 20:11 xonacs

Sorry, currently there is no work going on here as the project is kind of stale at the moment

bb-Ricardo avatar Nov 17 '25 11:11 bb-Ricardo