CLOUDSTACK-7150. [VMware] Global config 'vm.instancename' is not honored.

If global config 'vm.instancename' is set to true, VM name in vCenter should be '<instance_name>-<vm_hostname>'.
This commit is contained in:
Likitha Shetty 2014-07-22 09:48:20 +05:30
parent 4596ae9aac
commit b3e4c6d6dc
1 changed files with 2 additions and 1 deletions

View File

@ -1832,7 +1832,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
vmInternalCSName = vmSpec.getName();
if (_instanceNameFlag == true) {
String[] tokens = vmInternalCSName.split("-");
vmNameOnVcenter = String.format("%s-%s-%s", tokens[0], tokens[1], vmSpec.getHostName());
assert (tokens.length >= 3); // vmInternalCSName has format i-x-y-<instance.name>
vmNameOnVcenter = String.format("%s-%s-%s-%s", tokens[0], tokens[1], tokens[2], vmSpec.getHostName());
}
else
vmNameOnVcenter = vmSpec.getName();