From d9f5e63f69264b3b2b61bfc0b265a6a4adc7c80d Mon Sep 17 00:00:00 2001 From: keshav Date: Thu, 9 Dec 2010 21:28:10 -0800 Subject: [PATCH] Added a constructor for LoadBalancerConfigCommand, and a variable to keep track of a list of destinations. --- .../routing/LoadBalancerConfigCommand.java | 29 +++++++++++++++++++ .../com/cloud/network/rules/LoadBalancer.java | 2 ++ 2 files changed, 31 insertions(+) diff --git a/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java b/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java index 2b8332e467a..b807bd46b79 100644 --- a/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java +++ b/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java @@ -17,6 +17,11 @@ */ package com.cloud.agent.api.routing; +import java.util.List; + +import com.cloud.network.rules.LoadBalancer; +import com.cloud.network.rules.LoadBalancer.Destination; + /** * LoadBalancerConfigCommand sends the load balancer configuration * to the load balancer. Isn't that kinda obvious? @@ -25,8 +30,24 @@ public class LoadBalancerConfigCommand extends RoutingCommand { String srcIp; int srcPort; String protocol; + String algorithm; boolean revoked; boolean alreadyAdded; + DestinationTO[] destinations; + + public LoadBalancerConfigCommand(String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, List destinations) { + this.srcIp = srcIp; + this.srcPort = srcPort; + this.protocol = protocol; + this.algorithm = algorithm; + this.revoked = revoked; + this.alreadyAdded = alreadyAdded; + this.destinations = new DestinationTO[destinations.size()]; + int i = 0; + for (Destination destination : destinations) { + this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.getRevoked(), destination.getAlreadyAdded()); + } + } public String getSrcIp() { return srcIp; @@ -35,6 +56,10 @@ public class LoadBalancerConfigCommand extends RoutingCommand { public int getSrcPort() { return srcPort; } + + public String getAlgorithm() { + return algorithm; + } public String getProtocol() { return protocol; @@ -47,6 +72,10 @@ public class LoadBalancerConfigCommand extends RoutingCommand { public boolean isAlreadyAdded() { return alreadyAdded; } + + public DestinationTO[] getDestinations() { + return destinations; + } public class DestinationTO { String destIp; diff --git a/api/src/com/cloud/network/rules/LoadBalancer.java b/api/src/com/cloud/network/rules/LoadBalancer.java index a16cd599767..72097deea65 100644 --- a/api/src/com/cloud/network/rules/LoadBalancer.java +++ b/api/src/com/cloud/network/rules/LoadBalancer.java @@ -40,5 +40,7 @@ public interface LoadBalancer extends FirewallRule { String getIpAddress(); int getDestinationPortStart(); int getDestinationPortEnd(); + boolean getRevoked(); + boolean getAlreadyAdded(); } }