VPC : bug fix

This commit is contained in:
anthony 2012-06-11 17:05:51 -07:00 committed by Alena Prokharchyk
parent 6ab7a6075d
commit 95faedc09f
7 changed files with 38 additions and 13 deletions

View File

@ -32,6 +32,14 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand{
return nic;
}
public String getDefaultDns1() {
return defaultDns1;
}
public String getDefaultDns2() {
return defaultDns2;
}
public String getNetworkDomain() {
return networkDomain;
}

View File

@ -7038,7 +7038,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String gw = cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
String cidr = Long.toString(NetUtils.getCidrSize(nic.getNetmask()));;
String domainName = cmd.getNetworkDomain();
String dns = nic.getDns1();
String dns = cmd.getDefaultDns1();
if (dns == null || dns.isEmpty()) {
dns = cmd.getDefaultDns2();
} else {
String dns2= cmd.getDefaultDns2();
if ( dns2 != null && !dns2.isEmpty()) {
dns += "," + dns2;
}
}
try {
Set<VM> vms = VM.getByNameLabel(conn, domrName);
if ( vms == null || vms.isEmpty() ) {

View File

@ -144,16 +144,16 @@ public class XenServer56Resource extends CitrixResourceBase {
protected String networkUsage(Connection conn, final String privateIpAddress, final String option, final String vif) {
String args = "netusage.sh " + privateIpAddress + " ";
if (option.equals("get")) {
args = "-g";
args += "-g";
} else if (option.equals("create")) {
args = "-c";
args += "-c";
} else if (option.equals("reset")) {
args = "-r";
args += "-r";
} else if (option.equals("addVif")) {
args = "-a";
args += "-a ";
args += vif;
} else if (option.equals("deleteVif")) {
args = "-d";
args += "-d ";
args += vif;
}

View File

@ -330,7 +330,7 @@ setup_common() {
fi
ip route delete default
if [ "$RROUTER" != "1" ]
if [ "$RROUTER" != "1" -a -n $GW ]
then
if [ -z "$3" ]
then
@ -338,12 +338,12 @@ setup_common() {
else
ip route add default via $GW dev $3
fi
# a hacking way to activate vSwitch under VMware
ping -n -c 3 $GW &
sleep 3
pkill ping
fi
# a hacking way to activate vSwitch under VMware
ping -n -c 3 $GW &
sleep 3
pkill ping
if [ -n "$MGMTNET" -a -n "$LOCAL_GW" ]
then
ping -n -c 3 $LOCAL_GW &

View File

@ -70,10 +70,13 @@ desetup_dnsmasq() {
create_guest_network() {
logger -t cloud " $(basename $0): Create network on interface $dev, gateway $gw, network $ip/$mask "
# setup ip configuration
sudo ip addr add dev $dev $ip/$mask
sudo ip link set $dev up
sudo arping -c 3 -I $dev -A -U -s $ip $ip;
# setup rules to allow dhcp/dns request
sudo iptables -A INPUT -i $dev -p udp -m udp --dport 67 -j ACCEPT
sudo iptables -A INPUT -i $dev -p udp -m udp --dport 53 -j ACCEPT
# create inbound acl chain
if sudo iptables -N ACL_INBOUND_$ip 2>/dev/null

View File

@ -182,6 +182,12 @@ add_snat() {
sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;
return 0;
fi
# setup default gateway
sudo ip route | grep default
if [ $? -gt 0 ]
then
sudo ip route add default via $defaultGwIP dev $ethDev
fi
logger -t cloud "$(basename $0):Added SourceNAT $pubIp on interface $ethDev"
sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;

View File

@ -5,7 +5,7 @@
# if you change 'em here, you need to change it also in cloud.spec, add a %changelog entry there, and add an entry in debian/changelog
VERSION = '3.0.3.2012-06-11T23:14:43Z'
VERSION = '3.0.3.2012-06-11T22:40:12Z'
APPNAME = 'cloud'
import shutil,os