mirror of https://github.com/apache/cloudstack.git
VPC : many debug fix
This commit is contained in:
parent
657a40ad30
commit
a159255e36
|
|
@ -32,6 +32,10 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand{
|
|||
return nic;
|
||||
}
|
||||
|
||||
public String getNetworkDomain() {
|
||||
return networkDomain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -7023,6 +7023,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
String domrGIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
|
||||
String domrName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
|
||||
String gw = cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
|
||||
String cidr = Long.toString(NetUtils.getCidrSize(nic.getNetmask()));;
|
||||
String domainName = cmd.getNetworkDomain();
|
||||
String dns = nic.getDns1();
|
||||
try {
|
||||
Set<VM> vms = VM.getByNameLabel(conn, domrName);
|
||||
if ( vms == null || vms.isEmpty() ) {
|
||||
|
|
@ -7047,8 +7050,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
args += " -d " + dev;
|
||||
args += " -i " + domrGIP;
|
||||
args += " -g " + gw;
|
||||
args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
|
||||
args += " -s " + nic.getDns1();
|
||||
args += " -m " + cidr;
|
||||
if ( dns != null && !dns.isEmpty() ) {
|
||||
args += " -s " + dns;
|
||||
}
|
||||
if ( domainName != null && !domainName.isEmpty() ) {
|
||||
args += " -e " + domainName;
|
||||
}
|
||||
String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
|
||||
if (result == null || result.isEmpty()) {
|
||||
return new SetupGuestNetworkAnswer(cmd, false, "creating guest network failed due to " + ((result == null)? "null":result));
|
||||
|
|
|
|||
|
|
@ -110,14 +110,14 @@ expand-hosts
|
|||
# 2) Sets the "domain" DHCP option thereby potentially setting the
|
||||
# domain of all systems configured by DHCP
|
||||
# 3) Provides the domain part for "expand-hosts"
|
||||
domain=2.vmops-test.vmops.com
|
||||
#domain=2.vmops-test.vmops.com
|
||||
|
||||
# Uncomment this to enable the integrated DHCP server, you need
|
||||
# to supply the range of addresses available for lease and optionally
|
||||
# a lease time. If you have more than one network, you will need to
|
||||
# repeat this for each network on which you want to supply DHCP
|
||||
# service.
|
||||
dhcp-range=10.1.1.1,static
|
||||
#dhcp-range=10.1.1.1,static
|
||||
#dhcp-range=10.0.0.1,10.255.255.255
|
||||
dhcp-hostsfile=/etc/dhcphosts.txt
|
||||
|
||||
|
|
|
|||
|
|
@ -286,10 +286,13 @@ disable_hvc() {
|
|||
setup_common() {
|
||||
init_interfaces $1 $2 $3
|
||||
setup_interface "0" $ETH0_IP $ETH0_MASK
|
||||
setup_interface "1" $ETH1_IP $ETH1_MASK
|
||||
if [ -n "$ETH1_IP" ]
|
||||
then
|
||||
setup_interface "1" $ETH1_IP $ETH1_MASK
|
||||
fi
|
||||
if [ -n "$ETH2_IP" ]
|
||||
then
|
||||
setup_interface "2" $ETH2_IP $ETH2_MASK
|
||||
setup_interface "2" $ETH2_IP $ETH2_MASK
|
||||
fi
|
||||
|
||||
echo $NAME > /etc/hostname
|
||||
|
|
@ -349,46 +352,6 @@ setup_common() {
|
|||
fi
|
||||
}
|
||||
|
||||
setup_dnsmasq() {
|
||||
log_it "Setting up dnsmasq"
|
||||
[ -z $DHCP_RANGE ] && DHCP_RANGE=$ETH0_IP
|
||||
[ -z $DOMAIN ] && DOMAIN="cloudnine.internal"
|
||||
|
||||
if [ -n "$DOMAIN" ]
|
||||
then
|
||||
#send domain name to dhcp clients
|
||||
sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\"$DOMAIN\"/ /etc/dnsmasq.conf
|
||||
#DNS server will append $DOMAIN to local queries
|
||||
sed -r -i s/^[#]?domain=.*$/domain=$DOMAIN/ /etc/dnsmasq.conf
|
||||
#answer all local domain queries
|
||||
sed -i -e "s/^[#]*local=.*$/local=\/$DOMAIN\//" /etc/dnsmasq.conf
|
||||
|
||||
fi
|
||||
|
||||
if [ -n "$DNS_SEARCH_ORDER" ]
|
||||
then
|
||||
sed -i -e "/^[#]*dhcp-option.*=119.*$/d" /etc/dnsmasq.conf
|
||||
echo "dhcp-option-force=119,$DNS_SEARCH_ORDER" >> /etc/dnsmasq.conf
|
||||
# set the domain search order as a space seprated list for option 15
|
||||
DNS_SEARCH_ORDER=$(echo $DNS_SEARCH_ORDER | sed 's/,/ /g')
|
||||
#send domain name to dhcp clients
|
||||
sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\""$DNS_SEARCH_ORDER"\"/ /etc/dnsmasq.conf
|
||||
fi
|
||||
|
||||
|
||||
sed -i -e "s/^dhcp-range=.*$/dhcp-range=$DHCP_RANGE,static/" /etc/dnsmasq.conf
|
||||
sed -i -e "s/^[#]*listen-address=.*$/listen-address=$ETH0_IP/" /etc/dnsmasq.conf
|
||||
|
||||
if [ "$RROUTER" == "1" ]
|
||||
then
|
||||
sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf
|
||||
echo "dhcp-option=option:router,$GUEST_GW" >> /etc/dnsmasq.conf
|
||||
sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
|
||||
echo "dhcp-option=6,$GUEST_GW" >> /etc/dnsmasq.conf
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
setup_sshd(){
|
||||
local ip=$1
|
||||
[ -f /etc/ssh/sshd_config ] && sed -i -e "s/^[#]*ListenAddress.*$/ListenAddress $ip/" /etc/ssh/sshd_config
|
||||
|
|
@ -520,9 +483,6 @@ setup_router() {
|
|||
setup_redundant_router
|
||||
fi
|
||||
|
||||
setup_dnsmasq
|
||||
setup_apache2 $ETH0_IP
|
||||
|
||||
sed -i /gateway/d /etc/hosts
|
||||
|
||||
echo "$ETH0_IP $NAME" >> /etc/hosts
|
||||
|
|
|
|||
|
|
@ -32,20 +32,26 @@ usage() {
|
|||
|
||||
setup_dnsmasq() {
|
||||
loger -t cloud "Setting up dnsmasq for network $ip/$mask "
|
||||
|
||||
# setup static
|
||||
sed -i -e "/^[#]*dhcp-range=interface:$dev/d" /etc/dnsmasq.d/cloud.conf
|
||||
|
||||
echo "dhcp-range=interface:$dev,set:interface-$dev,$ip,static/" >> /etc/dnsmasq.d/cloud.conf
|
||||
|
||||
echo "dhcp-range=interface:$dev,set:interface-$dev,$ip,static" >> /etc/dnsmasq.d/cloud.conf
|
||||
# setup gateway
|
||||
sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,option:router.*$/d" /etc/dnsmasq.d/cloud.conf
|
||||
if [ -n "$gw" ]
|
||||
then
|
||||
echo "dhcp-option=tag:interface-$dev,option:router,$gw" >> /etc/dnsmasq.d/cloud.conf
|
||||
fi
|
||||
# setup DNS
|
||||
sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d" /etc/dnsmasq.d/cloud.conf
|
||||
if [ -n "$NS" ]
|
||||
if [ -n "$DNS" ]
|
||||
then
|
||||
echo "dhcp-option=tag:interface-$dev,6,$NS" >> /etc/dnsmasq.d/cloud.conf
|
||||
echo "dhcp-option=tag:interface-$dev,6,$DNS" >> /etc/dnsmasq.d/cloud.conf
|
||||
fi
|
||||
# setup DOMAIN
|
||||
sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,15.*$/d" /etc/dnsmasq.d/cloud.conf
|
||||
if [ -n "$DOMAIN" ]
|
||||
then
|
||||
echo "dhcp-option=tag:interface-$dev,15,$DOMAIN" >> /etc/dnsmasq.d/cloud.conf
|
||||
fi
|
||||
service dnsmasq restart
|
||||
sleep 1
|
||||
|
|
@ -72,14 +78,14 @@ create_guest_network() {
|
|||
then
|
||||
logger -t cloud "$(basename $0): create VPC inbound acl chain for network $ip/$mask"
|
||||
# policy drop
|
||||
sudo iptables -A ACL_INBOUND_$ip DROP >/dev/null
|
||||
sudo iptables -A ACL_INBOUND_$ip -j DROP >/dev/null
|
||||
sudo iptables -A FORWARD -o $dev -d $ip/$mask -j ACL_INBOUND_$ip
|
||||
fi
|
||||
# create outbound acl chain
|
||||
if sudo iptables -N ACL_OUTBOUND_$ip 2>/dev/null
|
||||
then
|
||||
logger -t cloud "$(basename $0): create VPC outbound acl chain for network $ip/$mask"
|
||||
sudo iptables -A ACL_OUTBOUND_$ip DROP >/dev/null
|
||||
sudo iptables -A ACL_OUTBOUND_$ip -j DROP >/dev/null
|
||||
sudo iptables -A FORWARD -i $dev -s $ip/$mask -j ACL_OUTBOUND_$ip
|
||||
fi
|
||||
|
||||
|
|
@ -111,7 +117,7 @@ Dflag=
|
|||
op=""
|
||||
|
||||
|
||||
while getopts 'CDg:n:m:c:v' OPTION
|
||||
while getopts 'CDn:m:d:i:g:s:e:' OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
C) Cflag=1
|
||||
|
|
@ -123,13 +129,13 @@ do
|
|||
n) nflag=1
|
||||
network="$OPTAGR"
|
||||
;;
|
||||
c) mflag=1
|
||||
m) mflag=1
|
||||
mask="$OPTARG"
|
||||
;;
|
||||
d) dflag=1
|
||||
dev="$OPTARG"
|
||||
;;
|
||||
v) iflag=1
|
||||
i) iflag=1
|
||||
ip="$OPTARG"
|
||||
;;
|
||||
g) gflag=1
|
||||
|
|
@ -137,6 +143,9 @@ do
|
|||
;;
|
||||
s) sflag=1
|
||||
DNS="$OPTARG"
|
||||
;;
|
||||
e) eflag=1
|
||||
DOMAIN="$OPTARG"
|
||||
;;
|
||||
?) usage
|
||||
unlock_exit 2 $lock $locked
|
||||
|
|
@ -145,13 +154,13 @@ do
|
|||
done
|
||||
|
||||
|
||||
if [ "$Cflag$Dflag$cflag" != "11" ]
|
||||
if [ "$Cflag$Dflag$dflag" != "11" ]
|
||||
then
|
||||
usage
|
||||
unlock_exit 2 $lock $locked
|
||||
fi
|
||||
|
||||
if [ "$Cflag" == "1" ] && ["$dflag$iflag$gflag$mflag" != "1111" ]
|
||||
if [ "$Cflag" == "1" ] && ["$iflag$gflag$mflag" != "111" ]
|
||||
then
|
||||
usage
|
||||
unlock_exit 2 $lock $locked
|
||||
|
|
|
|||
2
wscript
2
wscript
|
|
@ -4,7 +4,7 @@
|
|||
# the following two variables are used by the target "waf dist"
|
||||
# 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-07T00:21:40Z'
|
||||
VERSION = '3.0.3.2012-06-08T00:42:03Z'
|
||||
APPNAME = 'cloud'
|
||||
|
||||
import shutil,os
|
||||
|
|
|
|||
Loading…
Reference in New Issue