VPC : CS-15492, fix static route

This commit is contained in:
anthony 2012-07-10 15:15:28 -07:00
parent 4e5355b192
commit ed0b6c07ec
2 changed files with 11 additions and 11 deletions

View File

@ -7484,10 +7484,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
try {
String [][] rules = cmd.generateSRouteRules();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rules.length; i++) {
sb.append(rules[i]).append(',');
String[] srRules = rules[0];
for (int i = 0; i < srRules.length; i++) {
sb.append(srRules[i]).append(',');
}
String args = "vpc_staticroute.sh " + routerIp;
args += " -a " + sb.toString();
callResult = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
@ -7500,7 +7500,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
return new SetStaticRouteAnswer(cmd, true, results);
} catch (Exception e) {
String msg = "SetNetworkACL failed due to " + e.toString();
String msg = "SetStaticRoute failed due to " + e.toString();
s_logger.error(msg, e);
return new SetStaticRouteAnswer(cmd, false, results);
}

View File

@ -49,13 +49,13 @@ copy_table() {
backup_table() {
flush_table "static_route_back"
copy_table "static_route" "static_route_back"
flush table "static_route"
flush_table "static_route"
}
restore_table() {
flush_table "static_route"
copy_table "static_route_back" "static_route"
flush table "static_route_back"
flush_table "static_route_back"
}
static_route() {
@ -63,16 +63,16 @@ static_route() {
local ip=$(echo $rule | cut -d: -f1)
local gateway=$(echo $rule | cut -d: -f2)
local cidr=$(echo $rule | cut -d: -f3)
logger -t cloud "$(basename $0): static route: public ip=$publicIp \
logger -t cloud "$(basename $0): static route: public ip=$ip \
gateway=$gateway cidr=$cidr"
local dev=$(getDevByIp $ip)
local dev=$(getEthByIp $ip)
if [ $? -gt 0 ]
then
return 1
fi
sudo ip route table static_route add $cidr dev $dev via $gateway &>> $OUTFILE
sudo ip route add $cidr dev $dev via $gateway table static_route &>/dev/null
result=$?
logger -t cloud "$(basename $0): done static route: public ip=$publicIp \
logger -t cloud "$(basename $0): done static route: public ip=$ip \
gateway=$gateway cidr=$cidr"
return $result
}
@ -94,7 +94,7 @@ done
if [ -n "$rules" ]
then
rules_list=$(echo $rules | cut -d, --output-delimiter=" ")
rules_list=$(echo $rules | cut -d, -f1- --output-delimiter=" ")
fi
success=0