Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DFE6A118AE for ; Mon, 12 May 2014 23:35:43 +0000 (UTC) Received: (qmail 90060 invoked by uid 500); 12 May 2014 23:35:43 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 90032 invoked by uid 500); 12 May 2014 23:35:43 -0000 Mailing-List: contact commits-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 commits@cloudstack.apache.org Received: (qmail 90024 invoked by uid 99); 12 May 2014 23:35:43 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 May 2014 23:35:43 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 39A1D16B60; Mon, 12 May 2014 23:35:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kelveny@apache.org To: commits@cloudstack.apache.org Message-Id: <278992a966774b158d57bfb33985bc7f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.4-forward to 7e6390d Date: Mon, 12 May 2014 23:35:43 +0000 (UTC) Repository: cloudstack Updated Branches: refs/heads/4.4-forward f4c726d7b -> 7e6390d3c CLOUDSTACK-6647: appending instance name with custom supplied info that contains - character can break vmsync. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7e6390d3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7e6390d3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7e6390d3 Branch: refs/heads/4.4-forward Commit: 7e6390d3c845d9a0c918aa525b5cbfb2aa7fb3c5 Parents: f4c726d Author: Kelven Yang Authored: Thu May 1 15:40:04 2014 -0700 Committer: Kelven Yang Committed: Mon May 12 16:35:18 2014 -0700 ---------------------------------------------------------------------- api/src/com/cloud/vm/VirtualMachineName.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6390d3/api/src/com/cloud/vm/VirtualMachineName.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/vm/VirtualMachineName.java b/api/src/com/cloud/vm/VirtualMachineName.java index 4bbcb64..e6c2fba 100755 --- a/api/src/com/cloud/vm/VirtualMachineName.java +++ b/api/src/com/cloud/vm/VirtualMachineName.java @@ -18,8 +18,6 @@ package com.cloud.vm; import java.util.Formatter; -import com.cloud.dc.Vlan; - /** * VM Name. */ @@ -52,26 +50,16 @@ public class VirtualMachineName { public static boolean isValidVmName(String vmName, String instance) { String[] tokens = vmName.split(SEPARATOR); - /*Some vms doesn't have vlan/vnet id*/ - if (tokens.length != 5 && tokens.length != 4) { - return false; - } - if (!tokens[0].equals("i")) { + if (tokens.length <= 1) { return false; } - try { - Long.parseLong(tokens[1]); - Long.parseLong(tokens[2]); - if (tokens.length == 5 && !Vlan.UNTAGGED.equalsIgnoreCase(tokens[4])) { - Long.parseLong(tokens[4], 16); - } - } catch (NumberFormatException e) { + if (!tokens[0].equals("i")) { return false; } - return instance == null || instance.equals(tokens[3]); + return true; } public static String getVmName(long vmId, long userId, String instance) {