cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/object_store to 41272c9
Date Tue, 07 May 2013 06:02:47 GMT
Updated Branches:
  refs/heads/object_store 26424ff2a -> 41272c976


Add DeleteTemplate unit test.

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

Branch: refs/heads/object_store
Commit: 41272c976e5ffddacddf2fdff9d00a065da0c8a3
Parents: 26424ff
Author: Min Chen <min.chen@citrix.com>
Authored: Mon May 6 23:02:28 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Mon May 6 23:02:28 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/storage/test/TemplateTest.java      |   21 ++++++++++++++-
 .../integration-test/test/resource/testng.xml      |    4 +-
 .../cloud/storage/download/DownloadListener.java   |    2 +-
 .../cloud/template/HypervisorTemplateAdapter.java  |   21 ++++++++++-----
 4 files changed, 37 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41272c97/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TemplateTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TemplateTest.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TemplateTest.java
index 7749c07..a38b91c 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TemplateTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TemplateTest.java
@@ -61,7 +61,7 @@ public class TemplateTest extends CloudStackTestNGBase {
 	@Inject
 	DownloadMonitorImpl downloadMonitor;
 
-	
+
 	long dcId;
 	long templateId;
 
@@ -134,4 +134,23 @@ public class TemplateTest extends CloudStackTestNGBase {
         }
 	}
 
+   // @Test
+    public void deleteTemplate() {
+        TemplateInfo template = templateFactory.getTemplate(templateId);
+        DataStore store = dataStoreMgr.getImageStore(dcId);
+        AsyncCallFuture<TemplateApiResult> future = new AsyncCallFuture<TemplateApiResult>();
+        templateSvr.deleteTemplateAsync(template);
+        try {
+            TemplateApiResult result = future.get();
+            assertTrue(result.isSuccess(), "failed to delete template: " + result.getResult());
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            assertTrue(false, e.getMessage());
+        } catch (ExecutionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+             assertTrue(false, e.getMessage());
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41272c97/engine/storage/integration-test/test/resource/testng.xml
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/resource/testng.xml b/engine/storage/integration-test/test/resource/testng.xml
index dbadae1..4b07448 100644
--- a/engine/storage/integration-test/test/resource/testng.xml
+++ b/engine/storage/integration-test/test/resource/testng.xml
@@ -27,8 +27,8 @@
   <parameter name="primary-storage-want-to-add" value="nfs://192.168.56.2/opt/storage/primarynfs"/>
   <parameter name="devcloud-local-storage-uuid" value="cd10cac1-4772-92e5-5da6-c2bc16b1ce1b"/>
   <parameter name="devcloud-host-uuid" value="759ee4c9-a15a-297b-67c6-ac267d8aa429"/>
-  <!-- <parameter name="devcloud-secondary-storage" value="nfs://192.168.56.10/opt/storage/secondary"/>
-->
-  <parameter name="devcloud-secondary-storage" value="nfs://nfs2.lab.vmops.com:/export/home/edison/secondary"
/>
+  <parameter name="devcloud-secondary-storage" value="nfs://192.168.56.10/opt/storage/secondary"/>

+  <parameter name="primary-storage-uuid-want-to-add" value="759ee4c9-a15a-297b-67c6-ac267d8abe29"
/>
 
   <parameter name="s3-accesskey" value="OYAZXCAFUC1DAFOXNJWI"/>
   <parameter name="s3-secretkey" value="YHpRtzNDwl12DtrQmwRvdpnf2xK2AeVM30rXxQ=="/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41272c97/server/src/com/cloud/storage/download/DownloadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadListener.java b/server/src/com/cloud/storage/download/DownloadListener.java
index 84c51b1..001b45d 100755
--- a/server/src/com/cloud/storage/download/DownloadListener.java
+++ b/server/src/com/cloud/storage/download/DownloadListener.java
@@ -99,7 +99,7 @@ public class DownloadListener implements Listener {
 
 	public static final Logger s_logger = Logger.getLogger(DownloadListener.class.getName());
 	public static final int SMALL_DELAY = 100;
-    public static final long STATUS_POLL_INTERVAL = 300000L; //10000L;
+    public static final long STATUS_POLL_INTERVAL = 10000L;
 
 	public static final String DOWNLOADED=Status.DOWNLOADED.toString();
 	public static final String NOT_DOWNLOADED=Status.NOT_DOWNLOADED.toString();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41272c97/server/src/com/cloud/template/HypervisorTemplateAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
index 973b558..35bc5e5 100755
--- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java
+++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
@@ -193,13 +193,20 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
 		}
 	}
 
-	protected Void createTemplateAsyncCallBack(AsyncCallbackDispatcher<HypervisorTemplateAdapter,
-			TemplateApiResult> callback, CreateTemplateContext<TemplateApiResult> context)
{
-		TemplateInfo template = context.template;
-		VMTemplateVO tmplt = this._tmpltDao.findById(template.getId());
-		long accountId = tmplt.getAccountId();
-        if (template.getSize() != null) {
-            _resourceLimitMgr.incrementResourceCount(accountId, ResourceType.secondary_storage,
template.getSize());
+    protected Void createTemplateAsyncCallBack(AsyncCallbackDispatcher<HypervisorTemplateAdapter,
TemplateApiResult> callback,
+            CreateTemplateContext<TemplateApiResult> context) {
+        TemplateApiResult result = callback.getResult();
+        TemplateInfo template = context.template;
+        if (result.isFailed()) {
+            // failed in creating template, we need to remove those already
+            // populated template entry
+            _tmpltDao.remove(template.getId());
+        } else {
+            VMTemplateVO tmplt = this._tmpltDao.findById(template.getId());
+            long accountId = tmplt.getAccountId();
+            if (template.getSize() != null) {
+                _resourceLimitMgr.incrementResourceCount(accountId, ResourceType.secondary_storage,
template.getSize());
+            }
         }
 
 		return null;


Mime
View raw message