mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Allow autoscale group and name override (#8324)
Updates AutoScaleManager/AutoScaleManagerImpl so that getNextVmHostName and checkAutoScaleVmGroupName can be overridden in derivative implementations to allow for custom naming conditions and restrictions. If possible, would like to include this in 4.19 since it is a trivial change. This can be used to create an extension of AutoScaleManagerImpl.java, overriding these 2 methods
This commit is contained in:
parent
4e9c4a5895
commit
9773ba3e95
@ -55,4 +55,8 @@ public interface AutoScaleManager extends AutoScaleService {
|
|||||||
void checkIfVmActionAllowed(Long vmId);
|
void checkIfVmActionAllowed(Long vmId);
|
||||||
|
|
||||||
void removeVmFromVmGroup(Long vmId);
|
void removeVmFromVmGroup(Long vmId);
|
||||||
|
|
||||||
|
String getNextVmHostName(AutoScaleVmGroupVO asGroup);
|
||||||
|
|
||||||
|
void checkAutoScaleVmGroupName(String groupName);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1938,7 +1938,8 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNextVmHostName(AutoScaleVmGroupVO asGroup) {
|
@Override
|
||||||
|
public String getNextVmHostName(AutoScaleVmGroupVO asGroup) {
|
||||||
String vmHostNameSuffix = "-" + asGroup.getNextVmSeq() + "-" +
|
String vmHostNameSuffix = "-" + asGroup.getNextVmSeq() + "-" +
|
||||||
RandomStringUtils.random(VM_HOSTNAME_RANDOM_SUFFIX_LENGTH, 0, 0, true, false, (char[])null, new SecureRandom()).toLowerCase();
|
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
|
// Truncate vm group name because max length of vm name is 63
|
||||||
@ -1946,7 +1947,8 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManage
|
|||||||
return VM_HOSTNAME_PREFIX + asGroup.getName().substring(0, subStringLength) + vmHostNameSuffix;
|
return VM_HOSTNAME_PREFIX + asGroup.getName().substring(0, subStringLength) + vmHostNameSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAutoScaleVmGroupName(String groupName) {
|
@Override
|
||||||
|
public void checkAutoScaleVmGroupName(String groupName) {
|
||||||
String errorMessage = "";
|
String errorMessage = "";
|
||||||
if (groupName == null || groupName.length() > 255 || groupName.length() < 1) {
|
if (groupName == null || groupName.length() > 255 || groupName.length() < 1) {
|
||||||
errorMessage = "AutoScale Vm Group name must be between 1 and 255 characters long";
|
errorMessage = "AutoScale Vm Group name must be between 1 and 255 characters long";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user