DaanHoogland commented on code in PR #6571:
URL: https://github.com/apache/cloudstack/pull/6571#discussion_r970739976


##########
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:
   should this than not be the new contents of `checkAutoScaleUser()`?



-- 
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