File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919import java .util .Formatter ;
2020
21- import com .cloud .dc .Vlan ;
22-
2321/**
2422 * VM Name.
2523 */
@@ -52,26 +50,16 @@ public static boolean isValidVmName(String vmName) {
5250
5351 public static boolean isValidVmName (String vmName , String instance ) {
5452 String [] tokens = vmName .split (SEPARATOR );
55- /*Some vms doesn't have vlan/vnet id*/
56- if (tokens .length != 5 && tokens .length != 4 ) {
57- return false ;
58- }
5953
60- if (! tokens [ 0 ]. equals ( "i" ) ) {
54+ if (tokens . length <= 1 ) {
6155 return false ;
6256 }
6357
64- try {
65- Long .parseLong (tokens [1 ]);
66- Long .parseLong (tokens [2 ]);
67- if (tokens .length == 5 && !Vlan .UNTAGGED .equalsIgnoreCase (tokens [4 ])) {
68- Long .parseLong (tokens [4 ], 16 );
69- }
70- } catch (NumberFormatException e ) {
58+ if (!tokens [0 ].equals ("i" )) {
7159 return false ;
7260 }
7361
74- return instance == null || instance . equals ( tokens [ 3 ]) ;
62+ return true ;
7563 }
7664
7765 public static String getVmName (long vmId , long userId , String instance ) {
You can’t perform that action at this time.
0 commit comments