mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3287: [GSLB] API "updateGlobalLoadBalancerRule" is not
recognised by CloudStack added api to managementServerImpl and ensure glsb config is applied to gslb service providers
This commit is contained in:
parent
160b493285
commit
6a7369b20b
|
|
@ -28,7 +28,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = LoadBalancerResponse.class)
|
||||
@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject=GlobalLoadBalancerResponse.class)
|
||||
public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(GlobalLoadBalancerResponse.class.getName());
|
||||
|
||||
|
|
@ -99,7 +99,15 @@ public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
_gslbService.updateGlobalLoadBalancerRule(this);
|
||||
com.cloud.user.UserContext.current().setEventDetails("Global Load balancer Id: "+getId());
|
||||
GlobalLoadBalancerRule gslbRule = _gslbService.updateGlobalLoadBalancerRule(this);
|
||||
if (gslbRule != null) {
|
||||
GlobalLoadBalancerResponse response = _responseGenerator.createGlobalLoadBalancerResponse(gslbRule);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update global load balancer rule");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -109,6 +117,6 @@ public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return null;
|
||||
return "updating global load balancer rule";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ import org.apache.cloudstack.api.command.user.region.ha.gslb.AssignToGlobalLoadB
|
|||
import org.apache.cloudstack.api.command.user.region.ha.gslb.CreateGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.DeleteGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.ListGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.UpdateGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.RemoveFromGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.GetCloudIdentifierCmd;
|
||||
import org.apache.cloudstack.api.command.user.resource.ListHypervisorsCmd;
|
||||
|
|
@ -2767,6 +2768,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
cmdList.add(CreateGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(DeleteGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(ListGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(UpdateGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(AssignToGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(RemoveFromGlobalLoadBalancerRuleCmd.class);
|
||||
cmdList.add(ListStorageProvidersCmd.class);
|
||||
|
|
|
|||
|
|
@ -494,24 +494,31 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
|||
_accountMgr.checkAccess(caller, SecurityChecker.AccessType.ModifyEntry, true, gslbRule);
|
||||
|
||||
|
||||
if (!GlobalLoadBalancerRule.Algorithm.isValidAlgorithm(algorithm)) {
|
||||
if (algorithm != null && !GlobalLoadBalancerRule.Algorithm.isValidAlgorithm(algorithm)) {
|
||||
throw new InvalidParameterValueException("Invalid Algorithm: " + algorithm);
|
||||
}
|
||||
|
||||
if (!GlobalLoadBalancerRule.Persistence.isValidPersistence(stickyMethod)) {
|
||||
if (stickyMethod != null && !GlobalLoadBalancerRule.Persistence.isValidPersistence(stickyMethod)) {
|
||||
throw new InvalidParameterValueException("Invalid persistence: " + stickyMethod);
|
||||
}
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
gslbRule.setAlgorithm(algorithm);
|
||||
gslbRule.setPersistence(stickyMethod);
|
||||
gslbRule.setDescription(description);
|
||||
if (algorithm != null) {
|
||||
gslbRule.setAlgorithm(algorithm);
|
||||
}
|
||||
if (stickyMethod != null) {
|
||||
gslbRule.setPersistence(stickyMethod);
|
||||
}
|
||||
if (description != null) {
|
||||
gslbRule.setDescription(description);
|
||||
}
|
||||
gslbRule.setState(GlobalLoadBalancerRule.State.Add);
|
||||
_gslbRuleDao.update(gslbRule.getId(), gslbRule);
|
||||
txn.commit();
|
||||
|
||||
try {
|
||||
s_logger.debug("Updated global load balancer with id " + gslbRule.getUuid());
|
||||
s_logger.debug("Updating global load balancer with id " + gslbRule.getUuid());
|
||||
|
||||
// apply the gslb rule on to the back end gslb service providers on zones participating in gslb
|
||||
applyGlobalLoadBalancerRuleConfig(gslbRuleId, false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue