Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7A19910FBB for ; Thu, 26 Sep 2013 01:01:06 +0000 (UTC) Received: (qmail 36775 invoked by uid 500); 26 Sep 2013 01:01:06 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 36743 invoked by uid 500); 26 Sep 2013 01:01:05 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 36708 invoked by uid 99); 26 Sep 2013 01:01:05 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Sep 2013 01:01:05 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 848D790A68D; Thu, 26 Sep 2013 01:01:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: edison@apache.org To: commits@cloudstack.apache.org Date: Thu, 26 Sep 2013 01:01:05 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [01/24] git commit: updated refs/heads/master to 81ff479 Updated Branches: refs/heads/master 77bec4f2a -> 81ff4795d 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/b3ac12e1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b3ac12e1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b3ac12e1 Branch: refs/heads/master Commit: b3ac12e171713a11753157d0f207e11123fc6116 Parents: 77bec4f Author: Edison Su Authored: Tue Aug 20 15:33:05 2013 -0700 Committer: Edison Su Committed: Wed Sep 25 15:51:55 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/b3ac12e1/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java index f903715..e350a76 100644 --- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java +++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java @@ -40,4 +40,5 @@ StateDao listDestroyed(long storeId); + List findBySnapshotId(long snapshotId); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3ac12e1/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 d8e6abc..1935a88 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 cacheSearch; private SearchBuilder snapshotSearch; private SearchBuilder storeSnapshotSearch; + private SearchBuilder 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 " + @@ -101,6 +103,10 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase findBySnapshotId(long snapshotId) { + SearchCriteria sc = snapshotIdSearch.create(); + sc.setParameters("snapshot_id", snapshotId); + return listBy(sc); + } + + @Override public List listDestroyed(long id) { SearchCriteria sc = destroyedSearch.create(); sc.setParameters("store_id", id); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3ac12e1/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 5760725..1be94d9 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/b3ac12e1/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 8417066..96ffe35 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1042,6 +1042,10 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C List snapshots = _snapshotDao.listAllByStatus(Snapshot.State.Error); for (SnapshotVO snapshotVO : snapshots) { try { + List 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/b3ac12e1/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