You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ya...@apache.org on 2013/07/16 01:08:38 UTC

[1/2] git commit: updated refs/heads/master to cdbcc66

Updated Branches:
  refs/heads/master 2d30f42d0 -> cdbcc6663


CLOUDSTACK-3434: Improve the atomic of file lock used in VR

Now we would retry if "ls" failed, since the list of files changed.


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

Branch: refs/heads/master
Commit: a9549a7f81703f3a7219c7ca81c8e8c2659951db
Parents: 2d30f42
Author: Sheng Yang <sh...@citrix.com>
Authored: Fri Jul 12 17:34:47 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Mon Jul 15 16:08:27 2013 -0700

----------------------------------------------------------------------
 patches/systemvm/debian/config/root/func.sh | 41 ++++++++++++++++++------
 1 file changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9549a7f/patches/systemvm/debian/config/root/func.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/func.sh b/patches/systemvm/debian/config/root/func.sh
index 9c7c494..1796345 100644
--- a/patches/systemvm/debian/config/root/func.sh
+++ b/patches/systemvm/debian/config/root/func.sh
@@ -21,10 +21,26 @@
 # getLockFile() parameters
 # $1 lock filename
 # $2 timeout seconds
+
+#set -x
+
+getCurrLock() {
+    result=`ls $__LOCKDIR/*-$1.lock 2>/dev/null | head -n1`
+    while [ $? -ne 0 ]
+    do
+        result=`ls $__LOCKDIR/*-$1.lock 2>/dev/null| head -n1`
+    done
+    echo $result
+}
+
 getLockFile() {
+    lock=$1
+
     __locked=0
     __TS=`date +%s%N`
-    __LOCKFILE="/tmp/$__TS-$$-$1.lock"
+    __LOCKDIR="/tmp"
+    __LOCKFILE="$__LOCKDIR/$__TS-$$-$lock.lock"
+
     if [ $2 ]
     then
         __TIMEOUT=$2
@@ -34,7 +50,7 @@ getLockFile() {
 
     if [ -e $__LOCKFILE ]
     then
-        logger -t cloud "Process $0 pid $$ want to get ECLUSIVE LOCK $1 RECURSIVELY!"
+        logger -t cloud "Process $0 pid $$ want to get ECLUSIVE LOCK $lock RECURSIVELY!"
         psline=`ps u $$`
         logger -t cloud "Failed job detail: $psline"
         echo 0
@@ -47,26 +63,32 @@ getLockFile() {
     then
         return
     fi
-    
+
     for i in `seq 1 $(($__TIMEOUT * 10))`
     do
-        currlock=`ls /tmp/*-$1.lock | head -n1`
+        currlock=$(getCurrLock $lock)
         if [ $currlock -ef $__LOCKFILE ]
         then
             __locked=1
             break
         fi
+
         sleep 0.1
         if [ $((i % 10)) -eq 0 ]
         then
-            logger -t cloud "Process $0 pid $$ waiting for the lock $1 for another 1 second"
+            logger -t cloud "Process $0 pid $$ waiting for the lock $lock for another 1 second"
         fi
     done
     if [ $__locked -ne 1 ]
     then
-	logger -t cloud "fail to acquire the lock $1 for process $0 pid $$ after $__TIMEOUT seconds time out!"
-        cmd=`cat $currlock`
-	logger -t cloud "waiting for command: $cmd"
+        logger -t cloud "fail to acquire the lock $lock for process $0 pid $$ after $__TIMEOUT seconds time out!"
+        cmd=`cat $currlock 2>/dev/null`
+        if [ $? -eq 0 ]
+        then
+            logger -t cloud "waiting for process: $cmd"
+        else
+            logger -t cloud "didn't get info about process who we're waiting for"
+        fi
         psline=`ps u $$`
         logger -t cloud "Failed job detail: $psline"
         rm $__LOCKFILE
@@ -78,7 +100,8 @@ getLockFile() {
 # $1 lock filename
 # $2 locked(1) or not(0)
 releaseLockFile() {
-    __LOCKFILE="/tmp/*-$$-$1.lock"
+    __LOCKDIR="/tmp"
+    __LOCKFILE="$__LOCKDIR/*-$$-$1.lock"
     __locked=$2
     if [ "$__locked" == "1" ]
     then


[2/2] git commit: updated refs/heads/master to cdbcc66

Posted by ya...@apache.org.
CLOUDSTACK-3311: PVLAN - vmware dvswitch - stop/start nd reboot Virtual router FAIL

Description:

    Fix logic to check for secondary pvlan id already existing on vmware DVS, and
    fix int to Integer comparison.


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

Branch: refs/heads/master
Commit: cdbcc6663718fc92c20e576c3e958d6c2276aca0
Parents: a9549a7
Author: Vijayendra Bhamidipati <vi...@citrix.com>
Authored: Fri Jul 12 05:02:26 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Mon Jul 15 16:08:32 2013 -0700

----------------------------------------------------------------------
 .../vmware/mo/HypervisorHostHelper.java         | 28 +++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdbcc666/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index dc1486a..dd0f889 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -604,19 +604,29 @@ public class HypervisorHostHelper {
     private static void setupPVlanPair(DistributedVirtualSwitchMO dvSwitchMo, ManagedObjectReference morDvSwitch, 
             Integer vid, Integer spvlanid) throws Exception {
         Map<Integer, HypervisorHostHelper.PvlanType> vlanmap = dvSwitchMo.retrieveVlanPvlan(vid, spvlanid, morDvSwitch);
-        if (vlanmap.size() != 0) {
-            // Then either vid or pvlanid or both are already being used.
-            if (vlanmap.containsKey(vid) && vlanmap.get(vid) != HypervisorHostHelper.PvlanType.promiscuous) {
+        if (!vlanmap.isEmpty()) {
+            // Then either vid or pvlanid or both are already being used. Check how.
+            // First the primary pvlan id.
+            if (vlanmap.containsKey(vid) && !vlanmap.get(vid).equals(HypervisorHostHelper.PvlanType.promiscuous)) {
                 // This VLAN ID is already setup as a non-promiscuous vlan id on the DVS. Throw an exception.
-                String msg = "VLAN ID " + vid + " is already in use as a " + vlanmap.get(vid).toString() + " VLAN on the DVSwitch";
+                String msg = "Specified primary PVLAN ID " + vid + " is already in use as a " + vlanmap.get(vid).toString() + " VLAN on the DVSwitch";
                 s_logger.error(msg);
                 throw new Exception(msg);
             }
-            if ((vid != spvlanid) && vlanmap.containsKey(spvlanid) && vlanmap.get(spvlanid) != HypervisorHostHelper.PvlanType.isolated) {
-                // This PVLAN ID is already setup as a non-isolated vlan id on the DVS. Throw an exception.
-                String msg = "PVLAN ID " + spvlanid + " is already in use as a " + vlanmap.get(spvlanid).toString() + " VLAN in the DVSwitch";
-                s_logger.error(msg);
-                throw new Exception(msg);
+            // Next the secondary pvlan id.
+            if (spvlanid.equals(vid)) {
+                if (vlanmap.containsKey(spvlanid) && !vlanmap.get(spvlanid).equals(HypervisorHostHelper.PvlanType.promiscuous)) {
+                    String msg = "Specified secondary PVLAN ID " + spvlanid + " is already in use as a " + vlanmap.get(spvlanid).toString() + " VLAN in the DVSwitch";
+                    s_logger.error(msg);
+                    throw new Exception(msg);
+                }
+            } else {
+                if (vlanmap.containsKey(spvlanid) && !vlanmap.get(spvlanid).equals(HypervisorHostHelper.PvlanType.isolated)) {
+                    // This PVLAN ID is already setup as a non-isolated vlan id on the DVS. Throw an exception.
+                    String msg = "Specified secondary PVLAN ID " + spvlanid + " is already in use as a " + vlanmap.get(spvlanid).toString() + " VLAN in the DVSwitch";
+                    s_logger.error(msg);
+                    throw new Exception(msg);
+                }
             }
         }