cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/4.2 to dfa81da
Date Tue, 20 Aug 2013 22:33:40 GMT
Updated Branches:
  refs/heads/4.2 d7c49e485 -> dfa81da53


delete snapshot_store_ref if the snapshot is in error state


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

Branch: refs/heads/4.2
Commit: dfa81da53ad6681b7e49629b9e67c29db41dff89
Parents: d7c49e4
Author: Edison Su <sudison@gmail.com>
Authored: Tue Aug 20 15:33:05 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Tue Aug 20 15:33:24 2013 -0700

----------------------------------------------------------------------
 .../datastore/db/SnapshotDataStoreDao.java      |  1 +
 .../image/db/SnapshotDataStoreDaoImpl.java      | 13 ++++++++
 .../kvm/storage/LibvirtStorageAdaptor.java      |  3 +-
 .../com/cloud/storage/StorageManagerImpl.java   |  4 +++
 tools/marvin/marvin/deployAndRun.py             | 32 +++++++++++++++-----
 5 files changed, 45 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa81da5/engine/api/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java
b/engine/api/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java
index f903715..e350a76 100644
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java
@@ -40,4 +40,5 @@ StateDao<ObjectInDataStoreStateMachine.State, ObjectInDataStoreStateMachine.Even
     SnapshotDataStoreVO findBySnapshot(long snapshotId, DataStoreRole role);
 
     List<SnapshotDataStoreVO> listDestroyed(long storeId);
+    List<SnapshotDataStoreVO> findBySnapshotId(long snapshotId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa81da5/engine/storage/src/org/apache/cloudstack/storage/image/db/SnapshotDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/SnapshotDataStoreDaoImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/image/db/SnapshotDataStoreDaoImpl.java
index f33d51a..bee3436 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/SnapshotDataStoreDaoImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/SnapshotDataStoreDaoImpl.java
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import com.cloud.utils.db.SearchCriteria2;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
@@ -51,6 +52,7 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
     private SearchBuilder<SnapshotDataStoreVO> cacheSearch;
     private SearchBuilder<SnapshotDataStoreVO> snapshotSearch;
     private SearchBuilder<SnapshotDataStoreVO> storeSnapshotSearch;
+    private SearchBuilder<SnapshotDataStoreVO> snapshotIdSearch;
     private String parentSearch = "select store_id, store_role, snapshot_id from cloud.snapshot_store_ref
where store_id = ? " +
             " and store_role = ? and volume_id = ? and state = 'Ready'" +
             " order by created DESC " +
@@ -100,6 +102,10 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
         storeSnapshotSearch.and("store_role", storeSnapshotSearch.entity().getRole(), SearchCriteria.Op.EQ);
         storeSnapshotSearch.done();
 
+        snapshotIdSearch = createSearchBuilder();
+        snapshotIdSearch.and("snapshot_id", snapshotIdSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ);
+        snapshotIdSearch.done();
+
         return true;
     }
 
@@ -204,6 +210,13 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
     }
 
     @Override
+    public List<SnapshotDataStoreVO> findBySnapshotId(long snapshotId) {
+        SearchCriteria<SnapshotDataStoreVO> sc = snapshotIdSearch.create();
+        sc.setParameters("snapshot_id", snapshotId);
+        return listBy(sc);
+    }
+
+    @Override
     public List<SnapshotDataStoreVO> listDestroyed(long id) {
         SearchCriteria<SnapshotDataStoreVO> sc = destroyedSearch.create();
         sc.setParameters("store_id", id);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa81da5/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index d487e3c..a5dc075 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -397,7 +397,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
 
             return pool;
         } catch (LibvirtException e) {
-            throw new CloudRuntimeException(e.toString());
+            s_logger.debug("can't get storage pool",e);
+            throw new CloudRuntimeException(e.toString(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa81da5/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 67e3b47..e6c5d75 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1135,6 +1135,10 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
                     List<SnapshotVO> snapshots = _snapshotDao.listAllByStatus(Snapshot.State.Error);
                     for (SnapshotVO snapshotVO : snapshots) {
                         try {
+                            List<SnapshotDataStoreVO> storeRefs = _snapshotStoreDao.findBySnapshotId(snapshotVO.getId());
+                            for(SnapshotDataStoreVO ref : storeRefs) {
+                                _snapshotStoreDao.expunge(ref.getId());
+                            }
                             _snapshotDao.expunge(snapshotVO.getId());
                         } catch (Exception e) {
                             s_logger.warn("Unable to destroy " + snapshotVO.getId(), e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa81da5/tools/marvin/marvin/deployAndRun.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py
index 78c1617..d162fb3 100644
--- a/tools/marvin/marvin/deployAndRun.py
+++ b/tools/marvin/marvin/deployAndRun.py
@@ -17,6 +17,7 @@
 
 import deployDataCenter
 import TestCaseExecuteEngine
+import sys
 from argparse import ArgumentParser
 if __name__ == "__main__":
 
@@ -37,6 +38,8 @@ if __name__ == "__main__":
     parser.add_argument("-l", "--load", dest="load", action="store_true",
                         help="only load config, do not deploy,\
  it will only run testcase")
+    parser.add_argument("-n", "--num", dest="number",
+                        help="how many times you want run the test case")
 
     options = parser.parse_args()
 
@@ -52,23 +55,38 @@ if __name__ == "__main__":
         deploy.loadCfg()
     else:
         deploy.deploy()
+    iterates = 1
+    if options.number is not None:
+        if options.number == "loop":
+            iterates = sys.maxint
+        else:
+            try:
+                iterates = int(options.number)
+            except:
+                iterates = 1
 
     if options.testCaseFolder is None:
         if options.module is None:
             parser.print_usage()
             exit(1)
         else:
-            engine = \
-                TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
+            n = 0
+            while(n < iterates):
+                engine = \
+                    TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
                                                             deploy.getCfg(),
                                                             testCaseLogFile,
                                                             testResultLogFile)
-            engine.loadTestsFromFile(options.module)
-            engine.run()
+                engine.loadTestsFromFile(options.module)
+                engine.run()
+                n = n + 1
     else:
-        engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
+        n = 0
+        while(n<iterates):
+            engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
                                                              deploy.getCfg(),
                                                              testCaseLogFile,
                                                              testResultLogFile)
-        engine.loadTestsFromDir(options.testCaseFolder)
-        engine.run()
+            engine.loadTestsFromDir(options.testCaseFolder)
+            engine.run()
+            n = n + 1


Mime
View raw message