mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-8110. VM name in vCenter should be VM's DisplayName if global config 'vm.instancename.flag' is set.
This commit is contained in:
parent
507d9d337d
commit
51ee90074d
@ -1834,10 +1834,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
private Pair<String, String> composeVmNames(VirtualMachineTO vmSpec) {
|
||||
String vmInternalCSName = vmSpec.getName();
|
||||
String vmNameOnVcenter = vmSpec.getName();
|
||||
if (vmSpec.getType() == VirtualMachine.Type.User && _instanceNameFlag && vmSpec.getHostName() != null) {
|
||||
String[] tokens = vmInternalCSName.split("-");
|
||||
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());
|
||||
if (_instanceNameFlag && vmSpec.getHostName() != null) {
|
||||
vmNameOnVcenter = vmSpec.getHostName();
|
||||
}
|
||||
return new Pair<String, String>(vmInternalCSName, vmNameOnVcenter);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user