cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From priyankparihar <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1302: CLOUDSTACK-9104: VM naming convention in case...
Date Thu, 02 Mar 2017 10:27:29 GMT
Github user priyankparihar commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1302#discussion_r103892827
  
    --- Diff: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
---
    @@ -2226,17 +2227,33 @@ int getReservedCpuMHZ(VirtualMachineTO vmSpec) {
             return new String[] {datastoreDiskPath};
         }
     
    -    // 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();
    +    /**
    +     * This method generates VM name for Vcenter and Cloudstack( when Hypervisor is VMware).
    +     * It generates VM name according to  _instanceNameFlag setting.
    +     *
    +     * @param VirtualMachineTO
    +     *        vmSpec
    +     * @return Pair<internal CS name, vCenter display name>. A pair which contain
'internal CS name'  and
    +     *         'vCenter display name'(vCenter knows VM by this name).
    +     **/
    +    protected Pair<String, String> composeVmNames(VirtualMachineTO vmSpec) {
    +
    +        String vmInternalCSName = "";
    +        String vmNameOnVcenter  = "";
    +        if(vmSpec != null)
    +        {
    +            vmInternalCSName = vmNameOnVcenter = vmSpec.getName();
    +            if (_instanceNameFlag == true && vmSpec.getType() == VirtualMachine.Type.User)
{
    +                String[] tokens = vmInternalCSName.split("-");
    +                if(tokens.length<3) throw new InvalidParameterValueException("Invalid
vmInternalCSName format: "+vmInternalCSName+" expected format : *-*-* (e.g -> i-x-y)");
// vmInternalCSName has format i-x-y-<instance.name>
    +                vmNameOnVcenter = String.format("%s-%s-%s-%s", tokens[0], tokens[1],
tokens[2], vmSpec.getHostName());
    +            }
    +
             }
             return new Pair<String, String>(vmInternalCSName, vmNameOnVcenter);
         }
     
    -    protected void configNestedHVSupport(VirtualMachineMO vmMo, VirtualMachineTO vmSpec,
VirtualMachineConfigSpec vmConfigSpec) throws Exception {
    +    protected static void configNestedHVSupport(VirtualMachineMO vmMo, VirtualMachineTO
vmSpec, VirtualMachineConfigSpec vmConfigSpec) throws Exception {
    --- End diff --
    
    Removed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message