You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ap...@apache.org on 2013/11/08 13:21:46 UTC

git commit: updated refs/heads/4.2 to 27ea927

Updated Branches:
  refs/heads/4.2 48d9e2443 -> 27ea9274b


Template/ISO download fails cause the object to disappear from UI

Signed-off-by: Abhinandan Prateek <ap...@apache.org>


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

Branch: refs/heads/4.2
Commit: 27ea9274bdbbc876d65c6f4edeeee9d858794f4e
Parents: 48d9e24
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Fri Nov 8 09:53:18 2013 +0530
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Fri Nov 8 17:51:35 2013 +0530

----------------------------------------------------------------------
 .../storage/datastore/ObjectInDataStoreManagerImpl.java     | 9 ++-------
 .../src/com/cloud/template/HypervisorTemplateAdapter.java   | 6 +-----
 2 files changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27ea9274/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
index 652df43..d9a5164 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
@@ -86,6 +86,7 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager {
     public ObjectInDataStoreManagerImpl() {
         stateMachines = new StateMachine2<State, Event, DataObjectInStore>();
         stateMachines.addTransition(State.Allocated, Event.CreateOnlyRequested, State.Creating);
+        stateMachines.addTransition(State.Allocated, Event.DestroyRequested, State.Destroying);
         stateMachines.addTransition(State.Creating, Event.OperationFailed, State.Allocated);
         stateMachines.addTransition(State.Creating, Event.OperationSuccessed, State.Ready);
         stateMachines.addTransition(State.Ready, Event.CopyingRequested, State.Copying);
@@ -256,13 +257,7 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager {
             // Image store
             switch (dataObj.getType()) {
             case TEMPLATE:
-                TemplateDataStoreVO destTmpltStore = templateDataStoreDao.findByStoreTemplate(dataStore.getId(), objId);
-                if (destTmpltStore != null && destTmpltStore.getState() != ObjectInDataStoreStateMachine.State.Ready) {
-                    return templateDataStoreDao.remove(destTmpltStore.getId());
-                } else {
-                    s_logger.warn("Template " + objId + " is not found on image store " + dataStore.getId() + ", so no need to delete");
-                    return true;
-                }
+                return true;
             case SNAPSHOT:
                 SnapshotDataStoreVO destSnapshotStore = snapshotDataStoreDao.findByStoreSnapshot(dataStore.getRole(), dataStore.getId(), objId);
                 if (destSnapshotStore != null && destSnapshotStore.getState() != ObjectInDataStoreStateMachine.State.Ready) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27ea9274/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 00e6222..963aec9 100755
--- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java
+++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
@@ -232,11 +232,7 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
             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 {
+        if (result.isSuccess()) {
             VMTemplateVO tmplt = this._tmpltDao.findById(template.getId());
             long accountId = tmplt.getAccountId();
             if (template.getSize() != null) {