You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/06/20 22:37:43 UTC

git commit: updated refs/heads/master to 736bf54

Repository: cloudstack
Updated Branches:
  refs/heads/master 60f4203cb -> 736bf540e


Changed logic for copying snapshot from S3 to NFS staging store to prevent needless failure.

Signed-off-by: Daan Hoogland <da...@onecht.net>


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

Branch: refs/heads/master
Commit: 736bf540e8ef759a101d221622c64f3b3c3ed425
Parents: 60f4203
Author: Logan B <lb...@tqhosting.com>
Authored: Fri Jun 20 13:27:32 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Fri Jun 20 22:37:21 2014 +0200

----------------------------------------------------------------------
 .../storage/resource/NfsSecondaryStorageResource.java   | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/736bf540/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 6927f02..78f4bf1 100755
--- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -340,12 +340,14 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
             String downloadPath = determineStorageTemplatePath(storagePath, destPath);
             final File downloadDirectory = _storage.getFile(downloadPath);
 
-            if (!downloadDirectory.mkdirs()) {
-                final String errMsg = "Unable to create directory " + downloadPath + " to copy from S3 to cache.";
-                s_logger.error(errMsg);
-                return new CopyCmdAnswer(errMsg);
-            } else {
+            if (downloadDirectory.exists()) {
                 s_logger.debug("Directory " + downloadPath + " already exists");
+            } else {
+                if (!downloadDirectory.mkdirs()) {
+                    final String errMsg = "Unable to create directory " + downloadPath + " to copy from S3 to cache.";
+                    s_logger.error(errMsg);
+                    return new CopyCmdAnswer(errMsg);
+                }
             }
 
             File destFile = S3Utils.getFile(s3, s3.getBucketName(), srcData.getPath(), downloadDirectory, new FileNamingStrategy() {