protected boolean applyLBRules(DomainRouterVO elbVm, List<LoadBalancingRule> rules, long guestNetworkId) throws ResourceUnavailableException { Commands cmds = new Commands(Command.OnError.Continue); createApplyLoadBalancingRulesCommands(rules, elbVm, cmds, guestNetworkId); // Send commands to elbVm return sendCommandsToRouter(elbVm, cmds); }
@Override protected void runInContext() { garbageCollectUnusedElbVms(); }
DomainRouterVO elbVm = findElbVmForLb(rules.get(0)); lbRules.add(loadBalancing); return applyLBRules(elbVm, lbRules, network.getId()); } else if (elbVm.getState() == State.Stopped || elbVm.getState() == State.Stopping) { s_logger.debug("ELB VM is in " + elbVm.getState() + ", so not sending apply LoadBalancing rules commands to the backend");
@Override public void finalizeStop(VirtualMachineProfile profile, Answer answer) { if (answer != null) { DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId()); processStopOrRebootAnswer(elbVm, answer); } }
stop(elbVm, true); gceed = true; } catch (ConcurrentOperationException e) {
createApplyLoadBalancingRulesCommands(lbRules, elbVm, cmds, guestNetworkId);
@Override public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException { DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId()); List<NicProfile> nics = profile.getNics(); for (NicProfile nic : nics) { if (nic.getTrafficType() == TrafficType.Public) { elbVm.setPublicIpAddress(nic.getIPv4Address()); elbVm.setPublicNetmask(nic.getIPv4Netmask()); elbVm.setPublicMacAddress(nic.getMacAddress()); } else if (nic.getTrafficType() == TrafficType.Control) { elbVm.setPrivateIpAddress(nic.getIPv4Address()); elbVm.setPrivateMacAddress(nic.getMacAddress()); } } _routerDao.update(elbVm.getId(), elbVm); finalizeCommandsOnStart(cmds, profile); return true; }