diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index c2b9e25687a..287c30a5c3e 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -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); } diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_staticroute.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_staticroute.sh index 2c3f3ee9810..9f356923ea6 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_staticroute.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_staticroute.sh @@ -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