Skip to content

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

Open

Description

@Hidden-Network404

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

Activity

  1. bb-Ricardo commented on Jun 16, 2025

    @bb-Ricardo
    Owner

    Hi,

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

  2. Hidden-Network404 commented on Jun 17, 2025

    @Hidden-Network404
    Author

    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

  3. bb-Ricardo commented on Jun 18, 2025

    @bb-Ricardo
    Owner

    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:
      ;vm_tag_source =
    • 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

  4. xonacs commented on Nov 5, 2025

    @xonacs

    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?

  5. bb-Ricardo commented on Nov 17, 2025

    @bb-Ricardo
    Owner

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

  6. semx commented on Oct 10, 2026

    @semx
    Collaborator

    Implemented in development (#589), in the image ghcr.io/bb-ricardo/netbox-sync:development. Two new relations: vm_tenant_resource_pool_relation maps the resource pool path (Parent/Child, the root pool left out) or the plain pool name to a tenant, vm_tenant_folder_relation does the same for the VM folder path relative to the datacenter (Dept-A/Prod) or the plain folder name. Both take the regex = tenant lists vm_tenant_relation uses; vm_tenant_relation is tried first, then pool, then folder. The tag-based variant you mentioned as option 2 is not in this round; if the folder and pool mapping does not cover your layout, say so and I will look at it.

    Could you try it against your vCenter? Run with -n first, then a real run and a second one (the second should change nothing in NetBox), and say what came out, here or in the call for testing: #592. Nothing changes unless the option is set, so pulling the image is safe. It goes into 1.10.0, the next feature release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting replyAwaiting reply from issue owner

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions