-
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
base: main
Are you sure you want to change the base?
Conversation
Fixes apache#9505 Signed-off-by: Abhishek Kumar <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11327 +/- ##
=========================================
Coverage 17.35% 17.36%
- Complexity 15232 15237 +5
=========================================
Files 5885 5886 +1
Lines 525618 525694 +76
Branches 64157 64163 +6
=========================================
+ Hits 91225 91269 +44
- Misses 424094 424124 +30
- Partials 10299 10301 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
@blueorangutan package |
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14463 |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
@shwstppr |
@weizhouapache yes, though I wanted to confirm if it is a good idea to use the last 15 characters of the long generated name. Not using the first 15 as they can turn out to be the same. |
@shwstppr is it possible the first letter is unaccepted (for example |
Signed-off-by: Abhishek Kumar <[email protected]>
if (Character.isLetterOrDigit(hostName.charAt(0))) { | ||
return new Pair<>(hostName, name); | ||
} | ||
String temp = name.substring(0, Math.max(0, name.length() - 15)).replaceAll("[^a-zA-Z0-9]", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edge case: all of the last 15 chars are special chars or whitespace. I think we better do a replace first and then take the last 15.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaanHoogland I don't think this case can happen.
The only user-defined part in the VM name is the name of the autoscale group, and we've checks for that to only contain letters, numbers and hyphen. checkAutoScaleVmGroupName` does that
Signed-off-by: Abhishek Kumar <[email protected]>
@blueorangutan package |
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14730 |
} | ||
return new Pair<>(hostName, displayName); | ||
String hostName = name.substring(Math.max(0, name.length() - 15)); | ||
if (Character.isLetterOrDigit(hostName.charAt(0))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems digit it not supported as first char ? @shwstppr
cloudstack/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Lines 4104 to 4109 in 1272b13
public void checkNameForRFCCompliance(String name) { | |
if (!NetUtils.verifyDomainNameLabel(name, true)) { | |
throw new InvalidParameterValueException("Invalid name. Vm name can contain ASCII letters 'a' through 'z', the digits '0' through '9', " | |
+ "and the hyphen ('-'), must be between 1 and 63 characters long, and can't start or end with \"-\" and can't start with digit"); | |
} | |
} |
Description
Fixes #9505
Trim the generated name to take the last 15 characters.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?