weizhouapache commented on code in PR #11327:
URL: https://github.com/apache/cloudstack/pull/11327#discussion_r2300047784


##########
server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java:
##########
@@ -1968,12 +1968,19 @@ protected Pair<String, String> 
getNextVmHostAndDisplayName(AutoScaleVmGroupVO as
                 RandomStringUtils.random(VM_HOSTNAME_RANDOM_SUFFIX_LENGTH, 0, 
0, true, false, (char[])null, new SecureRandom()).toLowerCase();
         // Truncate vm group name because max length of vm name is 63
         int subStringLength = Math.min(asGroup.getName().length(), 63 - 
VM_HOSTNAME_PREFIX.length() - vmHostNameSuffix.length());
-        String displayName = VM_HOSTNAME_PREFIX + 
asGroup.getName().substring(0, subStringLength) + vmHostNameSuffix;
-        String hostName = displayName;
-        if (isWindows) {
-            hostName = displayName.substring(Math.max(0, displayName.length() 
- 15));
+        String name = VM_HOSTNAME_PREFIX + asGroup.getName().substring(0, 
subStringLength) + vmHostNameSuffix;
+        if (!isWindows) {
+            return new Pair<>(name, name);
         }
-        return new Pair<>(hostName, displayName);
+        String hostName = name.substring(Math.max(0, name.length() - 15));
+        if (Character.isLetterOrDigit(hostName.charAt(0))) {

Review Comment:
   it seems digit it not supported as first char ? @shwstppr 
   
   
https://github.com/apache/cloudstack/blob/1272b130878d0d8eb73caad2963343082d4be3fc/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java#L4104-L4109



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to