cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [1/3] git commit: updated refs/heads/4.4 to cefaa84
Date Sun, 31 Aug 2014 10:01:34 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 018bcd26f -> cefaa8440


CLOUDSTACK-7343; fix create folder in copyFromSwiftToNfs


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

Branch: refs/heads/4.4
Commit: 29c12bb78c37bf8c7ae4c2fd6f528974fc44e707
Parents: c4d1bf7
Author: Pierre-Luc Dion <pdion891@apache.org>
Authored: Thu Aug 14 10:15:27 2014 -0400
Committer: Pierre-Luc Dion <pdion891@apache.org>
Committed: Thu Aug 14 10:15:27 2014 -0400

----------------------------------------------------------------------
 .../storage/resource/NfsSecondaryStorageResource.java | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29c12bb7/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 78f4bf1..f095403 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
@@ -320,9 +320,17 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
         try {
             String downloadPath = determineStorageTemplatePath(storagePath, destPath);
             final File downloadDirectory = _storage.getFile(downloadPath);
-            if (!downloadDirectory.mkdirs()) {
-                return new CopyCmdAnswer("Failed to create download directory " + downloadPath);
-            }
+
+            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 Swift to cache.";
+                    s_logger.error(errMsg);
+                    return new CopyCmdAnswer(errMsg);
+                }
+            }            
+
             File destFile = SwiftUtil.getObject(swiftTO, downloadDirectory, srcData.getPath());
             return postProcessing(destFile, downloadPath, destPath, srcData, destData);
         } catch (Exception e) {


Mime
View raw message