VPC : use routerProxy to call networkUsage.sh
Conflicts:
core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c75fe801
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c75fe801
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c75fe801
Branch: refs/heads/vpc
Commit: c75fe80125ef7866745035511e4afc331f277845
Parents: 251a91f
Author: anthony <[email protected]>
Authored: Wed Jun 6 16:36:47 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Fri Jun 15 14:25:21 2012 -0700
----------------------------------------------------------------------
.../computing/LibvirtComputingResource.java | 16 +-
.../hypervisor/vmware/resource/VmwareResource.java | 2 +-
.../xen/resource/XenServer56Resource.java | 6 +-
.../debian/config/opt/cloud/bin/guestnw.sh | 172 +++++++++++++++
.../debian/config/opt/cloud/bin/netusage.sh | 153 +++++++++++++
patches/systemvm/debian/config/root/guestnw.sh | 172 ---------------
patches/systemvm/debian/config/root/netusage.sh | 153 -------------
scripts/network/domr/networkUsage.sh | 53 -----
scripts/vm/hypervisor/xenserver/vmops | 15 +--
scripts/vm/hypervisor/xenserver/xcpserver/patch | 1 -
scripts/vm/hypervisor/xenserver/xenserver56/patch | 1 -
.../vm/hypervisor/xenserver/xenserver56fp1/patch | 1 -
scripts/vm/hypervisor/xenserver/xenserver60/patch | 1 -
wscript | 2 +-
14 files changed, 339 insertions(+), 409 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git
a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
index 61d8b6a..9cdd863 100755
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
+++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
@@ -239,7 +239,7 @@ public class LibvirtComputingResource extends
ServerResourceBase implements
private String _createTmplPath;
private String _heartBeatPath;
private String _securityGroupPath;
- private String _networkUsagePath;
+ private String _routerProxyPath;
private String _host;
private String _dcId;
private String _pod;
@@ -543,11 +543,11 @@ public class LibvirtComputingResource extends
ServerResourceBase implements
"Unable to find the security_group.py");
}
- _networkUsagePath = Script.findScript("scripts/network/domr/",
- "networkUsage.sh");
- if (_networkUsagePath == null) {
+ _routerProxyPath = Script.findScript("scripts/network/domr/",
+ "routerProxy.sh");
+ if (_routerProxyPath == null) {
throw new ConfigurationException(
- "Unable to find the networkUsage.sh");
+ "Unable to find the routerProxy.sh");
}
String value = (String) params.get("developer");
@@ -2181,7 +2181,9 @@ public class LibvirtComputingResource extends
ServerResourceBase implements
protected String networkUsage(final String privateIpAddress,
final String option, final String vif) {
- Script getUsage = new Script(_networkUsagePath, s_logger);
+ Script getUsage = new Script(_routerProxyPath, s_logger);
+ getUsage.add("netusage.sh");
+ getUsage.add(privateIpAddress);
if (option.equals("get")) {
getUsage.add("-g");
} else if (option.equals("create")) {
@@ -2194,7 +2196,7 @@ public class LibvirtComputingResource extends
ServerResourceBase implements
getUsage.add("-d", vif);
}
- getUsage.add("-i", privateIpAddress);
+
final OutputInterpreter.OneLineParser usageParser = new
OutputInterpreter.OneLineParser();
String result = getUsage.execute(usageParser);
if (result != null) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index f4771b8..fe4ec44 100755
--- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1022,7 +1022,7 @@ public class VmwareResource implements
StoragePoolResource, ServerResource, Vmwa
protected Answer execute(CheckRouterCommand cmd) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Executing resource CheckRouterCommand: " +
_gson.toJson(cmd));
- s_logger.debug("Run command on domR " +
cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/checkrouter.sh
");
+ s_logger.debug("Run command on domR " +
cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ",
/opt/cloud/bin/checkrouter.sh ");
}
Pair<Boolean, String> result;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
----------------------------------------------------------------------
diff --git
a/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
b/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
index ff0c5d7..264cee5 100644
--- a/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
+++ b/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
@@ -142,7 +142,7 @@ public class XenServer56Resource extends CitrixResourceBase
{
@Override
protected String networkUsage(Connection conn, final String
privateIpAddress, final String option, final String vif) {
- String args = null;
+ String args = "netusage.sh " + privateIpAddress + " ";
if (option.equals("get")) {
args = "-g";
} else if (option.equals("create")) {
@@ -157,9 +157,7 @@ public class XenServer56Resource extends CitrixResourceBase
{
args += vif;
}
- args += " -i ";
- args += privateIpAddress;
- return callHostPlugin(conn, "vmops", "networkUsage", "args", args);
+ return callHostPlugin(conn, "vmops", "routerProxy", "args", args);
}
protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/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
new file mode 100755
index 0000000..d15f8a4
--- /dev/null
+++ b/patches/systemvm/debian/config/opt/cloud/bin/guestnw.sh
@@ -0,0 +1,172 @@
+#!/usr/bin/env bash
+# Copyright 2012 Citrix Systems, Inc. Licensed under the
+# Apache License, Version 2.0 (the "License"); you may not use this
+# file except in compliance with the License. Citrix Systems, Inc.
+# reserves all rights not expressly granted by the License.
+# You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Automatically generated by addcopyright.py at 04/03/2012
+
+# guestnw.sh -- create/destroy guest network
+# @VERSION@
+
+source /root/func.sh
+
+lock="biglock"
+locked=$(getLockFile $lock)
+if [ "$locked" != "1" ]
+then
+ exit 1
+fi
+
+usage() {
+ printf "Usage:\n %s -A -c <dev> -g <gateway> -m <network mask> -d <dns ip>
-r <dhcp ip range> [-f] \n" $(basename $0) >&2
+ printf " %s -D -c <dev> \n" $(basename $0) >&2
+}
+
+
+setup_dnsmasq() {
+ loger -t cloud "Setting up dnsmasq for network $ip/$mask "
+
+ 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
+
+ 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
+ sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d"
/etc/dnsmasq.d/cloud.conf
+ if [ -n "$NS" ]
+ then
+ echo "dhcp-option=tag:interface-$dev,6,$NS" >> /etc/dnsmasq.d/cloud.conf
+ fi
+ service dnsmasq restart
+ sleep 1
+}
+
+desetup_dnsmasq() {
+ loger -t cloud "Setting up dnsmasq for network $ip/$mask "
+
+ sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,option:router.*$/d"
/etc/dnsmasq.d/cloud.conf
+ sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d"
/etc/dnsmasq.d/cloud.conf
+ sed -i -e "/^[#]*dhcp-range=interface:$dev/d" /etc/dnsmasq.d/cloud.conf
+ service dnsmasq restart
+ sleep 1
+}
+
+
+create_guest_network() {
+ logger -t cloud " $(basename $0): Create network on interface $dev, gateway
$gw, network $ip/$mask "
+
+ sudo ip addr add $dev $ip/$mask
+
+ # create inbound acl chain
+ if sudo iptables -N ACL_INBOUND_$ip 2>/dev/null
+ 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 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 FORWARD -i $dev -s $ip/$mask -j ACL_OUTBOUND_$ip
+ fi
+
+ setup_dnsmasq
+}
+
+destroy_guest_network() {
+ logger -t cloud " $(basename $0): Create network on interface $dev, gateway
$gw, network $ip/$mask "
+ # destroy inbound acl chain
+ sudo iptables -F ACL_INBOUND_$ip 2>/dev/null
+ sudo iptables -D FORWARD -o $dev -d $ip/$mask -j ACL_INBOUND_$ip 2>/dev/null
+ sudo iptables -X ACL_INBOUND_$ip 2>/dev/null
+ # destroy outbound acl chain
+ sudo iptables -F ACL_OUTBOUND_$ip 2>/dev/null
+ sudo iptables -D FORWARD -i $dev -s $ip/$mask -j ACL_OUTBOUND_$ip
2>/dev/null
+ sudo iptables -X ACL_OUTBOUND_$ip 2>/dev/null
+
+ desetup_dnsmasq
+}
+
+#set -x
+nflag=0
+dflag=
+cflag=
+gflag=
+Cflag=
+Dflag=
+
+op=""
+
+
+while getopts 'CDg:n:m:c:v' OPTION
+do
+ case $OPTION in
+ C) Cflag=1
+ op="-C"
+ ;;
+ D) Dflag=1
+ op="-D"
+ ;;
+ n) nflag=1
+ network="$OPTAGR"
+ ;;
+ c) mflag=1
+ mask="$OPTARG"
+ ;;
+ d) dflag=1
+ dev="$OPTARG"
+ ;;
+ v) iflag=1
+ ip="$OPTARG"
+ ;;
+ g) gflag=1
+ gw="$OPTARG"
+ ;;
+ s) sflag=1
+ DNS="$OPTARG"
+ ;;
+ ?) usage
+ unlock_exit 2 $lock $locked
+ ;;
+ esac
+done
+
+
+if [ "$Cflag$Dflag$cflag" != "11" ]
+then
+ usage
+ unlock_exit 2 $lock $locked
+fi
+
+if [ "$Cflag" == "1" ] && ["$dflag$iflag$gflag$mflag" != "1111" ]
+then
+ usage
+ unlock_exit 2 $lock $locked
+fi
+
+
+if [ "$Cflag" == "1" ]
+then
+ create_guest_network
+fi
+
+
+if [ "$Dflag" == "1" ]
+then
+ destroy_guest_network
+fi
+
+unlock_exit 0 $lock $locked
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
b/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
old mode 100644
new mode 100755
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
b/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
new file mode 100755
index 0000000..d4307b9
--- /dev/null
+++ b/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
@@ -0,0 +1,153 @@
+#!/usr/bin/env bash
+# Copyright 2012 Citrix Systems, Inc. Licensed under the
+# Apache License, Version 2.0 (the "License"); you may not use this
+# file except in compliance with the License. Citrix Systems, Inc.
+# reserves all rights not expressly granted by the License.
+# You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Automatically generated by addcopyright.py at 04/03/2012
+
+
+
+
+
+# netusage.sh -- create iptable rules to gather network stats, running within
DomR
+
+source /root/func.sh
+
+lock="biglock"
+locked=$(getLockFile $lock)
+if [ "$locked" != "1" ]
+then
+ exit 1
+fi
+
+usage() {
+ printf "Usage: %s -[c|g|r] [-[a|d] <public interface>]\n" $(basename $0) >&2
+}
+
+create_usage_rules () {
+ iptables-save|grep "INPUT -j NETWORK_STATS" > /dev/null
+ if [ $? -eq 0 ]
+ then
+ return $?
+ fi
+ iptables -N NETWORK_STATS > /dev/null
+ iptables -I FORWARD -j NETWORK_STATS > /dev/null
+ iptables -I INPUT -j NETWORK_STATS > /dev/null
+ iptables -I OUTPUT -j NETWORK_STATS > /dev/null
+ iptables -A NETWORK_STATS -i eth0 -o eth2 > /dev/null
+ iptables -A NETWORK_STATS -i eth2 -o eth0 > /dev/null
+ iptables -A NETWORK_STATS -o eth2 ! -i eth0 -p tcp > /dev/null
+ iptables -A NETWORK_STATS -i eth2 ! -o eth0 -p tcp > /dev/null
+ return $?
+}
+
+add_public_interface () {
+ local pubIf=$1
+ iptables-save|grep "NETWORK_STATS -i eth0 -o $pubIf" > /dev/null
+ if [ $? -eq 0 ]
+ then
+ return $?
+ fi
+ iptables -A NETWORK_STATS -i eth0 -o $pubIf > /dev/null
+ iptables -A NETWORK_STATS -i $pubIf -o eth0 > /dev/null
+ iptables -A NETWORK_STATS -o $pubIf ! -i eth0 -p tcp > /dev/null
+ iptables -A NETWORK_STATS -i $pubIf ! -o eth0 -p tcp > /dev/null
+ return $?
+}
+
+delete_public_interface () {
+ local pubIf=$1
+ echo $pubIf >> /root/removedVifs
+ return $?
+}
+
+get_usage () {
+ iptables -L NETWORK_STATS -n -v -x | awk '$1 ~ /^[0-9]+$/ { printf "%s:",
$2}'; > /dev/null
+ if [ -f /root/removedVifs ] ; then iptables -Z NETWORK_STATS ; fi; >
/dev/null
+ /root/clearUsageRules.sh > /dev/null
+ if [ $? -gt 0 -a $? -ne 2 ]
+ then
+ printf $?
+ return 1
+ fi
+}
+
+reset_usage () {
+ iptables -Z NETWORK_STATS > /dev/null
+ if [ $? -gt 0 -a $? -ne 2 ]
+ then
+ return 1
+ fi
+}
+
+#set -x
+
+cflag=
+gflag=
+rflag=
+iflag=
+aflag=
+dflag=
+
+while getopts 'cgria:d:' OPTION
+do
+ case $OPTION in
+ c) cflag=1
+ ;;
+ g) gflag=1
+ ;;
+ r) rflag=1
+ ;;
+ a) aflag=1
+ publicIf="$OPTARG"
+ ;;
+ d) dflag=1
+ publicIf="$OPTARG"
+ ;;
+ i) #Do nothing, since it's parameter for host script
+ ;;
+ ?) usage
+ unlock_exit 2 $lock $locked
+ ;;
+ esac
+done
+
+if [ "$cflag" == "1" ]
+then
+ create_usage_rules
+ unlock_exit $? $lock $locked
+fi
+
+if [ "$gflag" == "1" ]
+then
+ get_usage
+ unlock_exit $? $lock $locked
+fi
+
+if [ "$rflag" == "1" ]
+then
+ reset_usage
+ unlock_exit $? $lock $locked
+fi
+
+if [ "$aflag" == "1" ]
+then
+ add_public_interface $publicIf
+ unlock_exit $? $lock $locked
+fi
+
+if [ "$dflag" == "1" ]
+then
+ delete_public_interface $publicIf
+ unlock_exit $? $lock $locked
+fi
+
+unlock_exit 0 $lock $locked
+
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/patches/systemvm/debian/config/root/guestnw.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/guestnw.sh
b/patches/systemvm/debian/config/root/guestnw.sh
deleted file mode 100755
index d15f8a4..0000000
--- a/patches/systemvm/debian/config/root/guestnw.sh
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-
-# guestnw.sh -- create/destroy guest network
-# @VERSION@
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
- exit 1
-fi
-
-usage() {
- printf "Usage:\n %s -A -c <dev> -g <gateway> -m <network mask> -d <dns ip>
-r <dhcp ip range> [-f] \n" $(basename $0) >&2
- printf " %s -D -c <dev> \n" $(basename $0) >&2
-}
-
-
-setup_dnsmasq() {
- loger -t cloud "Setting up dnsmasq for network $ip/$mask "
-
- 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
-
- 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
- sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d"
/etc/dnsmasq.d/cloud.conf
- if [ -n "$NS" ]
- then
- echo "dhcp-option=tag:interface-$dev,6,$NS" >> /etc/dnsmasq.d/cloud.conf
- fi
- service dnsmasq restart
- sleep 1
-}
-
-desetup_dnsmasq() {
- loger -t cloud "Setting up dnsmasq for network $ip/$mask "
-
- sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,option:router.*$/d"
/etc/dnsmasq.d/cloud.conf
- sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d"
/etc/dnsmasq.d/cloud.conf
- sed -i -e "/^[#]*dhcp-range=interface:$dev/d" /etc/dnsmasq.d/cloud.conf
- service dnsmasq restart
- sleep 1
-}
-
-
-create_guest_network() {
- logger -t cloud " $(basename $0): Create network on interface $dev, gateway
$gw, network $ip/$mask "
-
- sudo ip addr add $dev $ip/$mask
-
- # create inbound acl chain
- if sudo iptables -N ACL_INBOUND_$ip 2>/dev/null
- 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 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 FORWARD -i $dev -s $ip/$mask -j ACL_OUTBOUND_$ip
- fi
-
- setup_dnsmasq
-}
-
-destroy_guest_network() {
- logger -t cloud " $(basename $0): Create network on interface $dev, gateway
$gw, network $ip/$mask "
- # destroy inbound acl chain
- sudo iptables -F ACL_INBOUND_$ip 2>/dev/null
- sudo iptables -D FORWARD -o $dev -d $ip/$mask -j ACL_INBOUND_$ip 2>/dev/null
- sudo iptables -X ACL_INBOUND_$ip 2>/dev/null
- # destroy outbound acl chain
- sudo iptables -F ACL_OUTBOUND_$ip 2>/dev/null
- sudo iptables -D FORWARD -i $dev -s $ip/$mask -j ACL_OUTBOUND_$ip
2>/dev/null
- sudo iptables -X ACL_OUTBOUND_$ip 2>/dev/null
-
- desetup_dnsmasq
-}
-
-#set -x
-nflag=0
-dflag=
-cflag=
-gflag=
-Cflag=
-Dflag=
-
-op=""
-
-
-while getopts 'CDg:n:m:c:v' OPTION
-do
- case $OPTION in
- C) Cflag=1
- op="-C"
- ;;
- D) Dflag=1
- op="-D"
- ;;
- n) nflag=1
- network="$OPTAGR"
- ;;
- c) mflag=1
- mask="$OPTARG"
- ;;
- d) dflag=1
- dev="$OPTARG"
- ;;
- v) iflag=1
- ip="$OPTARG"
- ;;
- g) gflag=1
- gw="$OPTARG"
- ;;
- s) sflag=1
- DNS="$OPTARG"
- ;;
- ?) usage
- unlock_exit 2 $lock $locked
- ;;
- esac
-done
-
-
-if [ "$Cflag$Dflag$cflag" != "11" ]
-then
- usage
- unlock_exit 2 $lock $locked
-fi
-
-if [ "$Cflag" == "1" ] && ["$dflag$iflag$gflag$mflag" != "1111" ]
-then
- usage
- unlock_exit 2 $lock $locked
-fi
-
-
-if [ "$Cflag" == "1" ]
-then
- create_guest_network
-fi
-
-
-if [ "$Dflag" == "1" ]
-then
- destroy_guest_network
-fi
-
-unlock_exit 0 $lock $locked
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/patches/systemvm/debian/config/root/netusage.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/netusage.sh
b/patches/systemvm/debian/config/root/netusage.sh
deleted file mode 100644
index d4307b9..0000000
--- a/patches/systemvm/debian/config/root/netusage.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-
-
-
-
-
-# netusage.sh -- create iptable rules to gather network stats, running within
DomR
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
- exit 1
-fi
-
-usage() {
- printf "Usage: %s -[c|g|r] [-[a|d] <public interface>]\n" $(basename $0) >&2
-}
-
-create_usage_rules () {
- iptables-save|grep "INPUT -j NETWORK_STATS" > /dev/null
- if [ $? -eq 0 ]
- then
- return $?
- fi
- iptables -N NETWORK_STATS > /dev/null
- iptables -I FORWARD -j NETWORK_STATS > /dev/null
- iptables -I INPUT -j NETWORK_STATS > /dev/null
- iptables -I OUTPUT -j NETWORK_STATS > /dev/null
- iptables -A NETWORK_STATS -i eth0 -o eth2 > /dev/null
- iptables -A NETWORK_STATS -i eth2 -o eth0 > /dev/null
- iptables -A NETWORK_STATS -o eth2 ! -i eth0 -p tcp > /dev/null
- iptables -A NETWORK_STATS -i eth2 ! -o eth0 -p tcp > /dev/null
- return $?
-}
-
-add_public_interface () {
- local pubIf=$1
- iptables-save|grep "NETWORK_STATS -i eth0 -o $pubIf" > /dev/null
- if [ $? -eq 0 ]
- then
- return $?
- fi
- iptables -A NETWORK_STATS -i eth0 -o $pubIf > /dev/null
- iptables -A NETWORK_STATS -i $pubIf -o eth0 > /dev/null
- iptables -A NETWORK_STATS -o $pubIf ! -i eth0 -p tcp > /dev/null
- iptables -A NETWORK_STATS -i $pubIf ! -o eth0 -p tcp > /dev/null
- return $?
-}
-
-delete_public_interface () {
- local pubIf=$1
- echo $pubIf >> /root/removedVifs
- return $?
-}
-
-get_usage () {
- iptables -L NETWORK_STATS -n -v -x | awk '$1 ~ /^[0-9]+$/ { printf "%s:",
$2}'; > /dev/null
- if [ -f /root/removedVifs ] ; then iptables -Z NETWORK_STATS ; fi; >
/dev/null
- /root/clearUsageRules.sh > /dev/null
- if [ $? -gt 0 -a $? -ne 2 ]
- then
- printf $?
- return 1
- fi
-}
-
-reset_usage () {
- iptables -Z NETWORK_STATS > /dev/null
- if [ $? -gt 0 -a $? -ne 2 ]
- then
- return 1
- fi
-}
-
-#set -x
-
-cflag=
-gflag=
-rflag=
-iflag=
-aflag=
-dflag=
-
-while getopts 'cgria:d:' OPTION
-do
- case $OPTION in
- c) cflag=1
- ;;
- g) gflag=1
- ;;
- r) rflag=1
- ;;
- a) aflag=1
- publicIf="$OPTARG"
- ;;
- d) dflag=1
- publicIf="$OPTARG"
- ;;
- i) #Do nothing, since it's parameter for host script
- ;;
- ?) usage
- unlock_exit 2 $lock $locked
- ;;
- esac
-done
-
-if [ "$cflag" == "1" ]
-then
- create_usage_rules
- unlock_exit $? $lock $locked
-fi
-
-if [ "$gflag" == "1" ]
-then
- get_usage
- unlock_exit $? $lock $locked
-fi
-
-if [ "$rflag" == "1" ]
-then
- reset_usage
- unlock_exit $? $lock $locked
-fi
-
-if [ "$aflag" == "1" ]
-then
- add_public_interface $publicIf
- unlock_exit $? $lock $locked
-fi
-
-if [ "$dflag" == "1" ]
-then
- delete_public_interface $publicIf
- unlock_exit $? $lock $locked
-fi
-
-unlock_exit 0 $lock $locked
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/scripts/network/domr/networkUsage.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/networkUsage.sh
b/scripts/network/domr/networkUsage.sh
deleted file mode 100755
index 3b1450a..0000000
--- a/scripts/network/domr/networkUsage.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-
-
-
-
-
-# $Id: networkUsage.sh 9879 2010-06-24 02:41:46Z anthony $ $HeadURL:
svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/hypervisor/xenserver/networkUsage.sh
$
-# networkUsage.sh -- create iptable rules to gather network stats
-usage() {
- printf "Usage: %s -[c|g|r] -i <domR eth1 ip> [-[a|d] <public interface>]\n"
$(basename $0) >&2
-}
-
-check_gw() {
- ping -c 1 -n -q $1 > /dev/null
- if [ $? -gt 0 ]
- then
- sleep 1
- ping -c 1 -n -q $1 > /dev/null
- fi
- return $?;
-}
-
-cert="/root/.ssh/id_rsa.cloud"
-
-while getopts 'cgri:a:d:' OPTION
-do
- case $OPTION in
- i) iflag=1
- domRIp="$OPTARG"
- ;;
- esac
-done
-
-if ! check_gw "$domRIp"
-then
- printf "Unable to ping the routing domain, exiting\n" >&2
- exit 3
-fi
-
-ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp
"/root/netusage.sh $*"
-exit $?
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops
b/scripts/vm/hypervisor/xenserver/vmops
index daf07a0..2718f1e 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -372,19 +372,6 @@ def deleteFile(session, args):
return txt
-@echo
-def networkUsage(session, args):
- sargs = args['args']
- cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/networkUsage.sh")
- cmd.insert(0, "/bin/bash")
- try:
- txt = util.pread2(cmd)
- except:
- util.SMlog(" network usage error " )
- txt = ''
-
- return txt
def get_private_nic(session, args):
vms = session.xenapi.VM.get_all()
@@ -1442,7 +1429,7 @@ if __name__ == "__main__":
"vm_data": vm_data, "savePassword": savePassword,
"saveDhcpEntry": saveDhcpEntry, "setFirewallRule":
setFirewallRule, "routerProxy": routerProxy,
"setLoadBalancerRule": setLoadBalancerRule,
"createFile": createFile, "deleteFile": deleteFile,
- "networkUsage": networkUsage,
"network_rules":network_rules,
+ "network_rules":network_rules,
"can_bridge_firewall":can_bridge_firewall,
"default_network_rules":default_network_rules,
"destroy_network_rules_for_vm":destroy_network_rules_for_vm,
"default_network_rules_systemvm":default_network_rules_systemvm,
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/scripts/vm/hypervisor/xenserver/xcpserver/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch
b/scripts/vm/hypervisor/xenserver/xcpserver/patch
index 6e9603b..b26bd31 100644
--- a/scripts/vm/hypervisor/xenserver/xcpserver/patch
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch
@@ -26,7 +26,6 @@
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
-networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch
b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index 82f16a9..23c8761 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -24,7 +24,6 @@ pingtest.sh=../../..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
-networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index 345868e..c979c43 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -23,7 +23,6 @@ pingtest.sh=../../..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
-networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/scripts/vm/hypervisor/xenserver/xenserver60/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/patch
b/scripts/vm/hypervisor/xenserver/xenserver60/patch
index 4d6e971..a7212e8 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver60/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/patch
@@ -28,7 +28,6 @@ pingtest.sh=../../..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
-networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c75fe801/wscript
----------------------------------------------------------------------
diff --git a/wscript b/wscript
index 6e2f5a1..d562838 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-06T21:28:42Z'
+VERSION = '3.0.3.2012-06-06T23:35:14Z'
APPNAME = 'cloud'
import shutil,os