vCenter - New VM folder

I have read in the documentation about VCENTER_VM_FOLDER attribute that is set on VM creation in order to specify the destination folder.

I want to customice that attribute to automatically keep all user VMs on a separate folder without the need of fill this field in every VM creation. Is it posible?

You can set the attribute in the OpenNebula VM Template so it get’s inherited in the VM. You can clone the OpenNebula VM Template and add a different VCENTER_VM_FOLDER and assign it to different users or groups of users.

This is not what i’m looking for,

I would like to define 1 template that will be availabe for any user and then they will instantiate VMs. The point is to automatically (without user intervention) assign VCENTER_VM_FOLDER to the user name or user group.

Understood. Unfortunately there is no out of the box way to achieve this behaviour. It is an interesting feature, could you please open a feature request in the project’s github?

Sure, I’ll open it. In the mean while, could I achieve this by creating a hook script that modifies this parameter?
I have searched in the forum and found one topic talking about hooks that trigger before and after certain event occur, as I understood this is not a feature of opennebula but what I’m not sure is if I can move the newly created VM to a diferent vCenter folder after it is created and maybe running.

I believe you can define a hook that performs an update right in the pending state: http://docs.opennebula.io/5.12/integration/infrastructure_integration/hooks.html#state-hooks. However you may run into a race condition. Maybe a workflow where the VMs are deployed on hold can be applied to avoid this.

would it be feasible to create a cron job that run every day and ensures that every VM is in the right VCENTER_VM_FOLDER??