You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/06/16 00:38:03 UTC
[30/51] [abbrv] git commit: VPC : many debug fix
VPC : many debug fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/edbf4a0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/edbf4a0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/edbf4a0b
Branch: refs/heads/vpc
Commit: edbf4a0ba7b33a1adefdb66962bbdf234bfad54f
Parents: fb72b7e
Author: anthony <an...@cloud.com>
Authored: Thu Jun 7 17:53:12 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri Jun 15 14:26:41 2012 -0700
----------------------------------------------------------------------
.../cloud/agent/api/SetupGuestNetworkCommand.java | 4 +
.../xen/resource/CitrixResourceBase.java | 12 +++-
patches/systemvm/debian/config/etc/dnsmasq.conf | 4 +-
.../debian/config/etc/init.d/cloud-early-config | 50 ++-------------
.../debian/config/opt/cloud/bin/guestnw.sh | 35 +++++++----
wscript | 2 +-
6 files changed, 44 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edbf4a0b/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java b/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
index e36ca28..f5f57c8 100644
--- a/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
+++ b/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
@@ -32,6 +32,10 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand{
return nic;
}
+ public String getNetworkDomain() {
+ return networkDomain;
+ }
+
@Override
public boolean executeInSequence() {
return true;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edbf4a0b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index a5359ce..07daa4a 100644
--- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -7036,6 +7036,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() ) {
@@ -7060,8 +7063,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));
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edbf4a0b/patches/systemvm/debian/config/etc/dnsmasq.conf
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/dnsmasq.conf b/patches/systemvm/debian/config/etc/dnsmasq.conf
index f997004..ca32869 100644
--- a/patches/systemvm/debian/config/etc/dnsmasq.conf
+++ b/patches/systemvm/debian/config/etc/dnsmasq.conf
@@ -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
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edbf4a0b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index 5f59cde..aba817a 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -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
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edbf4a0b/patches/systemvm/debian/config/opt/cloud/bin/guestnw.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/guestnw.sh b/patches/systemvm/debian/config/opt/cloud/bin/guestnw.sh
index d15f8a4..c90ef76 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/guestnw.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/guestnw.sh
@@ -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
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edbf4a0b/wscript
----------------------------------------------------------------------
diff --git a/wscript b/wscript
index d9b5488..720e7b9 100644
--- a/wscript
+++ b/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