Adding number at the end of vmname when using catalog item

I has changed the the method “TesteEnv / Infrastructure / VM / Provisioning / Naming / vmname”, to get the vmname from a external database, and that working fine.

But when I provision a vm from a catalog item, my method change the name, but other method is adding a number like, vmteste_006, ou vmteste2_001.

Anyone know what the other method that can do it? I’m find that to alter.

Remember, it’s do with numbers only when using catalog item, when I provision a vm using a infrastructure, that’s working, without problem.

I’m guessing you’re seeing this if you provision multiple VMs as one service item?

When you provision from a service, the provisioning option “:miq_force_unique_name” is set to true, and it’s this variable that is being checked to decide whether to append the ‘__000n’ characters onto the end of your vmname. (:miq_force_unique_name is false by default when you provision from Infrastructure -> Virtual Machines). This is done to ensure that multiple servers that are provisioned from a single service catalog entry all have unique names.

To override this, you either need to set :miq_force_unique_name to be false in a custom method that handles your service (something like prov.set_option(:miq_force_unique_name, false), or name your VMs in a style that appends “$n{\d}” to the name, such as vmteste$n{2} or vmteste$n{3}. This will ensure that your VMs are named uniquely but predictably.

Hope this helps,