Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 17DB3200C29 for ; Tue, 28 Feb 2017 10:03:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 16786160B7E; Tue, 28 Feb 2017 09:03:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E99C160B6A for ; Tue, 28 Feb 2017 10:03:49 +0100 (CET) Received: (qmail 39427 invoked by uid 500); 28 Feb 2017 09:03:48 -0000 Mailing-List: contact issues-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list issues@cloudstack.apache.org Received: (qmail 39418 invoked by uid 500); 28 Feb 2017 09:03:48 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 39415 invoked by uid 99); 28 Feb 2017 09:03:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Feb 2017 09:03:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 13EA81A03B7 for ; Tue, 28 Feb 2017 09:03:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.546 X-Spam-Level: X-Spam-Status: No, score=-1.546 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id d5gxWBaJTAvg for ; Tue, 28 Feb 2017 09:03:47 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 9F3B25F23A for ; Tue, 28 Feb 2017 09:03:46 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 13AAFE0294 for ; Tue, 28 Feb 2017 09:03:46 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B3CA324154 for ; Tue, 28 Feb 2017 09:03:45 +0000 (UTC) Date: Tue, 28 Feb 2017 09:03:45 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-9104) VM naming convention in case vmware is used MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 28 Feb 2017 09:03:50 -0000 [ https://issues.apache.org/jira/browse/CLOUDSTACK-9104?page=3Dcom.atla= ssian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId= =3D15887610#comment-15887610 ]=20 ASF GitHub Bot commented on CLOUDSTACK-9104: -------------------------------------------- Github user rhtyd commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1302#discussion_r103405279 =20 --- Diff: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/re= source/VmwareResource.java --- @@ -2226,17 +2227,33 @@ int getReservedCpuMHZ(VirtualMachineTO vmSpec) = { return new String[] {datastoreDiskPath}; } =20 - // Pair - private Pair composeVmNames(VirtualMachineTO vmSpe= c) { - String vmInternalCSName =3D vmSpec.getName(); - String vmNameOnVcenter =3D vmSpec.getName(); - if (_instanceNameFlag && vmSpec.getHostName() !=3D null) { - vmNameOnVcenter =3D 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. A pair wh= ich contain 'internal CS name' and + * 'vCenter display name'(vCenter knows VM by this name). + **/ + protected Pair composeVmNames(VirtualMachineTO vmS= pec) { + + String vmInternalCSName =3D ""; + String vmNameOnVcenter =3D ""; + if(vmSpec !=3D null) + { + vmInternalCSName =3D vmNameOnVcenter =3D vmSpec.getName(); + if (_instanceNameFlag =3D=3D true && vmSpec.getType() =3D= =3D VirtualMachine.Type.User) { + String[] tokens =3D vmInternalCSName.split("-"); + if(tokens.length<3) throw new InvalidParameterValueExc= eption("Invalid vmInternalCSName format: "+vmInternalCSName+" expected form= at : *-*-* (e.g -> i-x-y)"); // vmInternalCSName has format i-x-y- + vmNameOnVcenter =3D String.format("%s-%s-%s-%s", token= s[0], tokens[1], tokens[2], vmSpec.getHostName()); --- End diff -- =20 The token length comparison may break backward compatibility for existi= ng VMs that may not conform to this scheme. Also, assuming the token length= is 3 the line can be written as: `vmNameOnVcenter =3D String.format("%s-%s", vmInternalCSName, vmSpec.ge= tHostName());` =20 As per previous code, `vmNameOnVcenter =3D vmSpec.getHostName()`, which= will introduce backward compatibility issues for older 4.3 environments. I= s there any code that handles for such old VMs. If a 4.3 user decides to up= grade to 4.10+, their VMs might not start the next time someone restarts. P= lease comment on how the change addresses backward compatibility issue. > VM naming convention in case vmware is used > ------------------------------------------- > > Key: CLOUDSTACK-9104 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-910= 4 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the defa= ult.)=20 > Reporter: Priyank Parihar > Assignee: Priyank Parihar > > ISSUE > =3D=3D=3D=3D=3D=3D > VM naming convention in case vmware is used. > Description > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > User with different account cannot create VMs with the same name, which w= as possible earlier (I am not sure in which CCP version). That time naming = convention used was like this =E2=80=9CI--=E2=80=9D > Currently if vm.instancename.flag is set to true the VM name will be exac= tly as display name given.=20 -- This message was sent by Atlassian JIRA (v6.3.15#6346)