A customer asked me how to track deployments of certain catalog templates. This is mainly for licensing or charging purposes where the provider creates and maintains (patches) OS templates which the tenants can consume via deployment from public catalog.
There are multiple ways how to achieve this. One involves tracking the deployment tasks from the catalog via Audit Event logs or RabbitMQ blocking tasks. The other I find very elegant is leveraging vCloud metadata which can be assigned to many vCloud Director objects. The actual feature has been present in vCloud Director for a long time (1.5) but is has had a few improvements since.
The owner of an object can create, update and delete up to 1024 name=value pairs on each particular object. An additional group of name=value pairs is under control of the system administrator who can chose visibility of such pair: hidden, read only or read/write. The metadata can be accessed both via GUI and API.
So back to our use case:
- As System Administrator create hidden metadata entry on the catalog VM. For example: “LicensingID = AAABBB“. This must be done before adding the VM to the public catalog.
- From now on every deployed VM from this catalog template will have this hidden metadata. The tenant user will not see it, however system admin will:
- Querying all VMs which contain this metadata can be done with one API call
GET https://vcloud.fojta.com/api/query?type=adminVM&filter=(metadata@SYSTEM:LicensingID==STRING:AAABBB)The response contains Org ID (highlighted in yellow) which can be used for cost allocation to each tenant.