Restrict VM names

Is there a way to restrict VM names (<VM><NAME>myvmname</NAME></VM>) when creating a VM. I would like to be able to use a specific regex. I tried using a “on create” hook, but if the hook fails, it doesn’t prevent the VM from beeing created. I also thought of using the ipam driver, but the VM Name is not available when the ipam driver is called.

Thank you.

Bumping this question, I’d really like to know if there is a way to achieve this.

There is no mechanism to do that out of the box. A hook that deletes the VM sounds reasonable, it shouldn’t be too hard to ensure it doesn’t fail (in most cases, of course :wink: )

Alternatively you can enforce this above the API level (ie, in the client your users utilize)

“Alternatively you can enforce this above the API level (ie, in the client your users utilize)”, you mean in sunstone ?