cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [02/10] git commit: updated refs/heads/master to 4ecfc29
Date Mon, 30 Nov 2015 21:42:59 GMT
Fix secondary storage not working with swift


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

Branch: refs/heads/master
Commit: 1e67a5d2c89009daabdcded86e9844824ec7d1ed
Parents: ad2bcc0
Author: Syed <syed1.mushtaq@gmail.com>
Authored: Fri Nov 27 13:48:18 2015 -0500
Committer: Syed <syed1.mushtaq@gmail.com>
Committed: Fri Nov 27 13:48:18 2015 -0500

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e67a5d2/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 be59691..888bb75 100644
--- 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
@@ -356,9 +356,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