-
Notifications
You must be signed in to change notification settings - Fork 1.2k
server: trim autoscale Windows VM hostname #11327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
36e636a
0c34a76
aa21706
b97ef66
4c9de62
4c9ff4c
16240b9
1857433
087f2ab
fa30c81
1efc967
313e4d4
d24ffc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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))) { | ||
weizhouapache marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return new Pair<>(hostName, name); | ||
| } | ||
| String temp = name.substring(0, Math.max(0, name.length() - 15)).replaceAll("[^a-zA-Z0-9]", ""); | ||
|
||
| if (!temp.isEmpty()) { | ||
| return new Pair<>(temp.charAt(temp.length() - 1) + hostName.substring(1), name); | ||
| } | ||
| return new Pair<>('a' + hostName.substring(1), name); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.