Unique VM names


Is it possible to enforce unique VM names in the OpenNebula Sunstone “Instantiate VM Template” interface?
I have set up the VM creation to generate DNS records based what you type into the “VM name” field and it would be nice to prevent users from generating duplicate VM names.

I run OpenNebula 5.4.6 on Ubuntu and VMware Vsphere 6.0.

Bumping this one. Anyone got any input here? Is enforcing unique VM names even possible?

As far as I know there is no built-in mechanism.
What you can do is, to include the VMID in the Hostname.
For exmaple:


… ]

Voila…uniqe hostnames (as long all hostname in this environment are controlled by this)

1 Like

Yeah that will create unique hostnames, but it will defeat the purpose of custom names for us. Anyways, thanks a lot for your input.

Yes I see what you mean.
If a Dev reads this:
It would be necessary to run a custom check script (defined in the template) when pressing “Create” Button. In this user created script all variables for the new VM and the ONE cli commands need to be accessible. The return value would determine if OpenNebula should continue instantiating the VM or not. Another return value for description can be shown in the error message (e.g. “Hostname not unique”). Just an idea…

Hello, your script can check for unique name and if is already used, them don;t create DNS record and write info about error to VM user template, so user can see it and can change vm name.