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/master to cb2a842
Date Thu, 18 Jul 2013 00:32:05 GMT
Updated Branches:
  refs/heads/master 1e3e131e1 -> cb2a84241


CLOUDSTACK-3513: [Automation] Failed to copy iso and template between
zones.


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

Branch: refs/heads/master
Commit: cb2a84241b5fd83c449afecdd898f6038ac06208
Parents: 1e3e131
Author: Min Chen <min.chen@citrix.com>
Authored: Wed Jul 17 17:24:03 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Jul 17 17:31:50 2013 -0700

----------------------------------------------------------------------
 .../storage/image/TemplateServiceImpl.java      | 26 ++++++++++++++++++--
 .../com/cloud/template/TemplateManagerImpl.java |  3 ---
 2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb2a8424/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index b972628..4a7ef53 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -580,8 +580,8 @@ public class TemplateServiceImpl implements TemplateService {
 
         TemplateOpContext<TemplateApiResult> context = new TemplateOpContext<TemplateApiResult>(null,
                 (TemplateObject) templateOnStore, future);
-        AsyncCallbackDispatcher<TemplateServiceImpl, CopyCommandResult> caller = AsyncCallbackDispatcher.create(this);
-        caller.setCallback(caller.getTarget().copyTemplateCallBack(null, null)).setContext(context);
+        AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> caller = AsyncCallbackDispatcher.create(this);
+        caller.setCallback(caller.getTarget().copyTemplateCrossZoneCallBack(null, null)).setContext(context);
         destStore.getDriver().createAsync(destStore, templateOnStore, caller);
         return future;
     }
@@ -652,6 +652,28 @@ public class TemplateServiceImpl implements TemplateService {
         return null;
     }
 
+    protected Void copyTemplateCrossZoneCallBack(AsyncCallbackDispatcher<TemplateServiceImpl,
CreateCmdResult> callback, TemplateOpContext<TemplateApiResult> context) {
+        TemplateInfo destTemplate = context.getTemplate();
+        CreateCmdResult result = callback.getResult();
+        AsyncCallFuture<TemplateApiResult> future = context.getFuture();
+        TemplateApiResult res = new TemplateApiResult(destTemplate);
+        try {
+            if (result.isFailed()) {
+                res.setResult(result.getResult());
+                destTemplate.processEvent(Event.OperationFailed);
+            } else {
+                destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
+            }
+            future.complete(res);
+        } catch (Exception e) {
+            s_logger.debug("Failed to process copy template cross zones callback", e);
+            res.setResult(e.toString());
+            future.complete(res);
+        }
+
+        return null;
+    }
+
     @Override
     public void addSystemVMTemplatesToSecondary(DataStore store) {
         long storeId = store.getId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb2a8424/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index c7cc818..c6446ac 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -634,9 +634,6 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
             createEventType = EventTypes.EVENT_TEMPLATE_CREATE;
         }
 
-        Transaction txn = Transaction.currentTxn();
-        txn.start();
-
         TemplateInfo srcTemplate = this._tmplFactory.getTemplate(template.getId(), srcSecStore);
         // Copy will just find one eligible image store for the destination zone
         // and copy template there, not propagate to all image stores


Mime
View raw message