private long removeLBrule(AutoScaleVmGroupVO asGroup) { long lbId = asGroup.getLoadBalancerId(); long instanceId = -1; List<LoadBalancerVMMapVO> LbVmMapVos = _lbVmMapDao.listByLoadBalancerId(lbId); if ((LbVmMapVos != null) && (LbVmMapVos.size() > 0)) { for (LoadBalancerVMMapVO LbVmMapVo : LbVmMapVos) { instanceId = LbVmMapVo.getInstanceId(); } } // take last VM out of the list List<Long> lstVmId = new ArrayList<Long>(); if (instanceId != -1) lstVmId.add(instanceId); if (_loadBalancingRulesService.removeFromLoadBalancer(lbId, lstVmId, new HashMap<Long, List<String>>())) return instanceId; else return -1; }
@Override public void execute() { CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); Map<Long, List<String>> vmIdIpsMap = getVmIdIpListMap(); try { boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule"); } }catch (InvalidParameterValueException ex) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to remove instance from load balancer rule"); } }
@Override public void execute() { CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); final Map<Long, List<String>> vmIdIpsMap = getVmIdIpListMap(); try { final boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule"); } } catch (final InvalidParameterValueException ex) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to remove instance from load balancer rule"); } }