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/4.2-forward to 80aa0d3
Date Sat, 07 Sep 2013 00:28:15 GMT
Updated Branches:
  refs/heads/4.2-forward f05d6a541 -> 80aa0d360


CLOUDSTACK-4625:Snapshots and templates should be deleted from staging
storage after create template from snapshot on S3.

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

Branch: refs/heads/4.2-forward
Commit: 80aa0d36086fce90353fce91301496f2a44e137d
Parents: f05d6a5
Author: Min Chen <min.chen@citrix.com>
Authored: Fri Sep 6 17:27:30 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Sep 6 17:27:30 2013 -0700

----------------------------------------------------------------------
 .../storage/motion/AncientDataMotionStrategy.java |  5 +++++
 .../VmwareStorageSubsystemCommandHandler.java     | 10 +++++++++-
 .../resource/NfsSecondaryStorageResource.java     | 18 +++++++++++++++++-
 3 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/80aa0d36/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index 4aa0147..1d57921 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -439,6 +439,11 @@ public class
         CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait,
_mgmtServer.getExecuteInSequence());
         EndPoint ep = selector.select(srcData, destData);
         Answer answer = ep.sendMessage(cmd);
+        
+        // clean up snapshot copied to staging 
+        if (srcData != null) {
+            cacheMgr.deleteCacheObject(srcData);
+        }
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/80aa0d36/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
index f2ba492..ba72e8f 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java
@@ -102,7 +102,15 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
                 TemplateObjectTO template = (TemplateObjectTO)answer.getNewData();
                 template.setDataStore(srcDataStore);
                 CopyCommand newCmd = new CopyCommand(template, destData, cmd.getWait(), cmd.executeInSequence());
-                return storageResource.defaultAction(newCmd);
+                Answer result = storageResource.defaultAction(newCmd);
+                //clean up template data on staging area
+                try {
+                    DeleteCommand deleteCommand = new DeleteCommand(template);
+                    storageResource.defaultAction(deleteCommand);
+                } catch (Exception e) {
+                    s_logger.debug("Failed to clean up staging area:", e);
+                }
+                return result;                
             }
             needDelegation = true;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/80aa0d36/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 3e19b64..3a563cb 100755
--- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -526,6 +526,14 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
                     SwiftUtil.putObject(swift, properties, containterName, _tmpltpp);
                 }
 
+                //clean up template data on staging area
+                try {
+                    DeleteCommand deleteCommand = new DeleteCommand(newTemplate);
+                    execute(deleteCommand);
+                } catch (Exception e) {
+                    s_logger.debug("Failed to clean up staging area:", e);
+                }  
+                
                 TemplateObjectTO template = new TemplateObjectTO();
                 template.setPath(swiftPath);
                 template.setSize(templateFile.length());
@@ -543,7 +551,15 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
                 TemplateObjectTO newTemplate = (TemplateObjectTO)answer.getNewData();
                 newTemplate.setDataStore(srcDataStore);
                 CopyCommand newCpyCmd = new CopyCommand(newTemplate, destData, cmd.getWait(),
cmd.executeInSequence());
-                return copyFromNfsToS3(newCpyCmd);
+                Answer result = copyFromNfsToS3(newCpyCmd);
+                //clean up template data on staging area
+                try {
+                    DeleteCommand deleteCommand = new DeleteCommand(newTemplate);
+                    execute(deleteCommand);
+                } catch (Exception e) {
+                    s_logger.debug("Failed to clean up staging area:", e);
+                }  
+                return result;
             }
         }
         s_logger.debug("Failed to create templat from snapshot");


Mime
View raw message