You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2014/05/27 07:32:25 UTC

[1/2] git commit: updated refs/heads/4.4-forward to 37a3a65

Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 2ab7bcade -> 37a3a65c7


CLOUDSTACK-6328: run.sh check if an existing java process is running, before spawining new ones

Signed-off-by: Jayapal <ja...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/587ee544
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/587ee544
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/587ee544

Branch: refs/heads/4.4-forward
Commit: 587ee544f2d8223599e5ee8c56f926ebf7882b8c
Parents: 2ab7bca
Author: Saurav Lahiri <sa...@sungard.com>
Authored: Tue Apr 15 12:08:11 2014 +0000
Committer: Jayapal <ja...@apache.org>
Committed: Tue May 27 10:56:04 2014 +0530

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/init.d/cloud | 14 ++++-----
 systemvm/scripts/run.sh                         | 30 +++++++++++++++-----
 systemvm/scripts/utils.sh                       | 21 ++++++++++++++
 3 files changed, 50 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/587ee544/systemvm/patches/debian/config/etc/init.d/cloud
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud b/systemvm/patches/debian/config/etc/init.d/cloud
index 83853bc..b18b8b1 100755
--- a/systemvm/patches/debian/config/etc/init.d/cloud
+++ b/systemvm/patches/debian/config/etc/init.d/cloud
@@ -75,17 +75,15 @@ _failure() {
 }
 RETVAL=$?
 CLOUDSTACK_HOME="/usr/local/cloud"
+if [ -f  $CLOUDSTACK_HOME/systemvm/utils.sh ];
+then
+  . $CLOUDSTACK_HOME/systemvm/utils.sh
+else
+  _failure
+fi
 
 # mkdir -p /var/log/vmops
 
-get_pids() {
-  local i
-  for i in $(ps -ef| grep java | grep -v grep | awk '{print $2}'); 
-  do 
-    echo $(pwdx $i) | grep "$CLOUDSTACK_HOME"  | awk -F: '{print $1}'; 
-  done
-}
-
 start() {
    local pid=$(get_pids)
    if [ "$pid" != "" ]; then

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/587ee544/systemvm/scripts/run.sh
----------------------------------------------------------------------
diff --git a/systemvm/scripts/run.sh b/systemvm/scripts/run.sh
index 146d96f..b6a3a27 100755
--- a/systemvm/scripts/run.sh
+++ b/systemvm/scripts/run.sh
@@ -23,15 +23,31 @@
 #_run.sh runs the agent client.
 
 # set -x
- 
+readonly PROGNAME=$(basename "$0")
+readonly LOCKDIR=/tmp
+readonly LOCKFD=500
+
+CLOUDSTACK_HOME="/usr/local/cloud"
+. $CLOUDSTACK_HOME/systemvm/utils.sh
+
+LOCKFILE=$LOCKDIR/$PROGNAME.xlock
+lock $LOCKFILE $LOCKFD
+if [ $? -eq 1 ];then
+  exit 1
+fi 
+
 while true
 do
-  ./_run.sh "$@" &
-  wait
-  ex=$?
-  if [ $ex -eq 0 ] || [ $ex -eq 1 ] || [ $ex -eq 66 ] || [ $ex -gt 128 ]; then
-      # permanent errors
-      sleep 5
+  pid=$(get_pids)
+  action=`cat /usr/local/cloud/systemvm/user_request`
+  if [ "$pid" == "" ] && [ "$action" == "start" ] ; then
+    ./_run.sh "$@" &
+    wait
+    ex=$?
+    if [ $ex -eq 0 ] || [ $ex -eq 1 ] || [ $ex -eq 66 ] || [ $ex -gt 128 ]; then
+        # permanent errors
+        sleep 5
+    fi
   fi
 
   # user stop agent by service cloud stop

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/587ee544/systemvm/scripts/utils.sh
----------------------------------------------------------------------
diff --git a/systemvm/scripts/utils.sh b/systemvm/scripts/utils.sh
new file mode 100644
index 0000000..4d55fc7
--- /dev/null
+++ b/systemvm/scripts/utils.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+CLOUDSTACK_HOME="/usr/local/cloud"
+
+get_pids() {
+  local i
+  for i in $(ps -ef| grep java | grep -v grep | awk '{print $2}');
+  do
+    echo $(pwdx $i) | grep "$CLOUDSTACK_HOME"  | awk -F: '{print $1}';
+  done
+}
+
+lock()
+{
+  lockfile=$1
+  lockfd=$2
+  eval "exec $lockfd>$lockfile"
+  flock -n $lockfd\
+        && return 0 \
+        || return 1
+}


[2/2] git commit: updated refs/heads/4.4-forward to 37a3a65

Posted by ja...@apache.org.
CLOUDSTACK-6761: Fixed removing proxy arp rule on deleting static nat or PF rule on ip

    The proxy-arp add/del is done on firewall rule add/del.
    The proxy-arp rule is deleted only when there is no static nat or dest nat rule is not using the ip.

    When there is static nat or PF and firewall rule
     a. Delete firewall rule. It skips delete proxy-arp because the rule is used by static nat rule.
     b. After deleting fw rule if we disable static nat there is no way to delete proxy-arp rule.

     On VM expunge we are deleting firewall rules first then static nat rules. This caused the stale proxy-arp
     rules.

    With this fix adding/deleting proxy arp rule on static nat/PF rule add/del.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/37a3a65c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/37a3a65c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/37a3a65c

Branch: refs/heads/4.4-forward
Commit: 37a3a65c7c7f083a5536c078a1c8436ef9e14597
Parents: 587ee54
Author: Jayapal <ja...@apache.org>
Authored: Mon May 26 15:10:35 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Tue May 27 10:56:21 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/network/resource/JuniperSrxResource.java       | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37a3a65c/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
index ed6011b..2089b1d 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
@@ -965,6 +965,7 @@ public class JuniperSrxResource implements ServerResource {
     private void addStaticNatRule(Long publicVlanTag, String publicIp, String privateIp, List<FirewallRuleTO> rules) throws ExecutionException {
         manageStaticNatRule(SrxCommand.ADD, publicIp, privateIp);
         manageAddressBookEntry(SrxCommand.ADD, _privateZone, privateIp, null);
+        manageProxyArp(SrxCommand.ADD, publicVlanTag, publicIp);
 
         // Add a new security policy with the current set of applications
         addSecurityPolicyAndApplications(SecurityPolicyType.STATIC_NAT, privateIp, extractApplications(rules));
@@ -979,6 +980,7 @@ public class JuniperSrxResource implements ServerResource {
         removeSecurityPolicyAndApplications(SecurityPolicyType.STATIC_NAT, privateIp);
 
         manageAddressBookEntry(SrxCommand.DELETE, _privateZone, privateIp, null);
+        manageProxyArp(SrxCommand.DELETE, publicVlanTag, publicIp);
 
         s_logger.debug("Removed static NAT rule for public IP " + publicIp + ", and private IP " + privateIp);
     }
@@ -1248,6 +1250,7 @@ public class JuniperSrxResource implements ServerResource {
         List<Object[]> applications = new ArrayList<Object[]>();
         applications.add(new Object[] {protocol, destPortStart, destPortEnd});
         addSecurityPolicyAndApplications(SecurityPolicyType.DESTINATION_NAT, privateIp, applications);
+        manageProxyArp(SrxCommand.ADD, publicVlanTag, publicIp);
 
         String srcPortRange = srcPortStart + "-" + srcPortEnd;
         String destPortRange = destPortStart + "-" + destPortEnd;
@@ -1258,6 +1261,7 @@ public class JuniperSrxResource implements ServerResource {
     private void removeDestinationNatRule(Long publicVlanTag, String publicIp, String privateIp, int srcPort, int destPort) throws ExecutionException {
         manageDestinationNatRule(SrxCommand.DELETE, publicIp, privateIp, srcPort, destPort);
         manageDestinationNatPool(SrxCommand.DELETE, privateIp, destPort);
+        manageProxyArp(SrxCommand.DELETE, publicVlanTag, publicIp);
 
         removeSecurityPolicyAndApplications(SecurityPolicyType.DESTINATION_NAT, privateIp);