weizhouapache commented on code in PR #6571: URL: https://github.com/apache/cloudstack/pull/6571#discussion_r970762242
########## server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java: ########## @@ -340,7 +341,27 @@ private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, Aut String csUrl = ApiServiceConfiguration.ApiServletPath.value(); Network.Provider provider = getLoadBalancerServiceProvider(lb); if (Network.Provider.Netscaler.equals(provider)) { - autoScaleManager.checkAutoScaleUser(autoScaleVmProfile.getAutoScaleUserId(), vmGroup.getAccountId()); + Long autoscaleUserId = autoScaleVmProfile.getAutoScaleUserId(); + if (autoscaleUserId == null) { + throw new InvalidParameterValueException("autoscaleUserId is required but not specified"); + } + User user = _userDao.findById(autoscaleUserId); + if (user == null) { + throw new InvalidParameterValueException("Unable to find user by id " + autoscaleUserId); + } + apiKey = user.getApiKey(); + secretKey = user.getSecretKey(); + if (apiKey == null) { + throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it"); + } + + if (secretKey == null) { + throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it"); + } + + if (csUrl == null || csUrl.contains("localhost")) { + throw new InvalidParameterValueException(String.format("Global setting %s has to be set to the Management Server's API end point", ApiServiceConfiguration.ApiServletPath.key())); + } Review Comment: @DaanHoogland You might notice that I have changes to use `checkAutoScaleUser` and then reverted back. because `apiKey` and `secretKey` are updated in these lines, but `checkAutoScaleUser` will not update them. -- 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: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org