cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [1/3] git commit: updated refs/heads/4.4 to eb41250
Date Wed, 02 Apr 2014 23:06:55 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 74c947b65 -> eb41250a4


Don't let VMsync touch the VM if VM has been scheduled for HA but HA is not yet running.


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

Branch: refs/heads/4.4
Commit: e92838368550bf3c540226284cd68682d43c0741
Parents: 74c947b
Author: Kelven Yang <kelveny@gmail.com>
Authored: Fri Mar 21 10:58:14 2014 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Wed Apr 2 16:01:06 2014 -0700

----------------------------------------------------------------------
 .../com/cloud/ha/HighAvailabilityManagerImpl.java  |  2 +-
 .../src/com/cloud/ha/dao/HighAvailabilityDao.java  |  2 ++
 .../com/cloud/ha/dao/HighAvailabilityDaoImpl.java  | 17 +++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9283836/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
index 406b9b2..1318d9b 100755
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -967,7 +967,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements
HighAvai
 
     @Override
     public boolean hasPendingHaWork(long vmId) {
-        List<HaWorkVO> haWorks = _haDao.listRunningHaWorkForVm(vmId);
+        List<HaWorkVO> haWorks = _haDao.listPendingHaWorkForVm(vmId);
         return haWorks.size() > 0;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9283836/server/src/com/cloud/ha/dao/HighAvailabilityDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/dao/HighAvailabilityDao.java b/server/src/com/cloud/ha/dao/HighAvailabilityDao.java
index 7f532f2..85135bb 100644
--- a/server/src/com/cloud/ha/dao/HighAvailabilityDao.java
+++ b/server/src/com/cloud/ha/dao/HighAvailabilityDao.java
@@ -81,4 +81,6 @@ public interface HighAvailabilityDao extends GenericDao<HaWorkVO, Long>
{
      * @return List of work items
      */
     List<HaWorkVO> listRunningHaWorkForVm(long vmId);
+
+    List<HaWorkVO> listPendingHaWorkForVm(long vmId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9283836/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java b/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
index c0da883..d25c6a7 100644
--- a/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
+++ b/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
@@ -49,6 +49,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<HaWorkVO,
Long> impl
     private final SearchBuilder<HaWorkVO> ReleaseSearch;
     private final SearchBuilder<HaWorkVO> FutureHaWorkSearch;
     private final SearchBuilder<HaWorkVO> RunningHaWorkSearch;
+    private final SearchBuilder<HaWorkVO> PendingHaWorkSearch;
 
     protected HighAvailabilityDaoImpl() {
         super();
@@ -106,6 +107,22 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<HaWorkVO,
Long> impl
         RunningHaWorkSearch.and("taken", RunningHaWorkSearch.entity().getDateTaken(), Op.NNULL);
         RunningHaWorkSearch.and("step", RunningHaWorkSearch.entity().getStep(), Op.NIN);
         RunningHaWorkSearch.done();
+
+        PendingHaWorkSearch = createSearchBuilder();
+        PendingHaWorkSearch.and("instance", PendingHaWorkSearch.entity().getInstanceId(),
Op.EQ);
+        PendingHaWorkSearch.and("type", PendingHaWorkSearch.entity().getType(), Op.EQ);
+        PendingHaWorkSearch.and("step", PendingHaWorkSearch.entity().getStep(), Op.NIN);
+        PendingHaWorkSearch.done();
+    }
+
+    @Override
+    public List<HaWorkVO> listPendingHaWorkForVm(long vmId) {
+        SearchCriteria<HaWorkVO> sc = PendingHaWorkSearch.create();
+        sc.setParameters("instance", vmId);
+        sc.setParameters("type", WorkType.HA);
+        sc.setParameters("step", Step.Done, Step.Error, Step.Cancelled);
+
+        return search(sc, null);
     }
 
     @Override


Mime
View raw message