mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7349: Catching exception in API assigntoloadbalancerrule command
This commit is contained in:
parent
19ffc93e2e
commit
73d53e5f43
|
|
@ -23,6 +23,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -165,8 +166,14 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
|
|||
CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ","));
|
||||
|
||||
Map<Long, List<String>> vmIdIpsMap = getVmIdIpListMap();
|
||||
boolean result = false;
|
||||
|
||||
try {
|
||||
result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap);
|
||||
}catch (CloudRuntimeException ex) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule");
|
||||
}
|
||||
|
||||
boolean result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
setResponseObject(response);
|
||||
|
|
|
|||
Loading…
Reference in New Issue