cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject git commit: updated refs/heads/4.4-forward to 7e6390d
Date Mon, 12 May 2014 23:35:43 GMT
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 <kelveny@gmail.com>
Authored: Thu May 1 15:40:04 2014 -0700
Committer: Kelven Yang <kelveny@gmail.com>
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) {


Mime
View raw message