Yesterday, we submitted this pull request: https://github.com/apache/cloudstack/pull/1492
This originally grew out of making the VirtualMachineName class non-static (original PR is mentioned in the above link). We're presenting this as a refactoring of the existing code to enable more extensibility and flexibility, make unit testing easier, and unify the way CloudStack generates resource names. There is an associated JIRA ticket at CLOUDSTACK-9003. I will be writing up a design document for the CS wiki in the next few days. jburwell wanted me to open a discussion on the developer list about the PR and how it is implemented: There is now a ResourceNamingPolicyManager and a bunch of ResourceNamingPolicies. The manager exposes a method to get a policy for a type of resource, and the naming policies generate UUIDs + resource names. The default naming policies generate names exactly the same way as they are created now. This is in a new module called default-naming-policies. By excluding this module and loading our own naming policies, we gain the ability to change how names are generated.