[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15044382#comment-15044382
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9104:
--------------------------------------------

Github user bhaisaab commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1165#discussion_r46787171
  
    --- Diff: 
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 ---
    @@ -1889,11 +1889,20 @@ int getReservedCpuMHZ(VirtualMachineTO vmSpec) {
     
         // Pair<internal CS name, vCenter display name>
         private Pair<String, String> composeVmNames(VirtualMachineTO vmSpec) {
    -        String vmInternalCSName = vmSpec.getName();
    -        String vmNameOnVcenter = vmSpec.getName();
    -        if (_instanceNameFlag && vmSpec.getHostName() != null) {
    -            vmNameOnVcenter = vmSpec.getHostName();
    +
    +        String vmInternalCSName = null;
    +        String vmNameOnVcenter  = null;
    +        if(vmSpec != null)
    +        {
    +            vmInternalCSName = vmNameOnVcenter = vmSpec.getName();
    +            if (_instanceNameFlag == true) {
    +                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());
    --- End diff --
    
    @priyankparihar can you comment on the issues and motivation around this? 
Do you think we have users who would want to keep hostname as VM names on 
vCenter side if the global setting is enabled (the _instanceNameFlag is true).
    
    If this is not true, by default the name (as returned by the vmSpec) is 
like: i-[0-9]*-[0-9]*-VM. (The suffix "VM", is taken from another global 
setting where the default value is "VM").


> VM naming convention in case vmware is used
> -------------------------------------------
>
>                 Key: CLOUDSTACK-9104
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9104
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Priyank Parihar
>
> ISSUE
> ======
> VM naming convention in case vmware is used.
> Description
> ==========
> User with different account cannot create VMs with the same name, which was 
> possible earlier (I am not sure in which CCP version). That time naming 
> convention used was like this “I-<user-id>-<Display-Name>”
> Currently if vm.instancename.flag is set to true the VM name will be exactly 
> as display name given. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to