Skip to content

Commit df0797a

Browse files
committed
Merge pull request #1133 from syed/4.6
Fix secondary storage not working with swiftOriginal PR and discussion at #1112 * pr/1133: Fix secondary storage not working with swift Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents 7dcc654 + 1e67a5d commit df0797a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,17 @@ protected Answer copyFromSwiftToNfs(CopyCommand cmd, DataTO srcData, SwiftTO swi
356356
try {
357357
String downloadPath = determineStorageTemplatePath(storagePath, destPath);
358358
final File downloadDirectory = _storage.getFile(downloadPath);
359-
if (!downloadDirectory.mkdirs()) {
360-
return new CopyCmdAnswer("Failed to create download directory " + downloadPath);
359+
360+
if (downloadDirectory.exists()) {
361+
s_logger.debug("Directory " + downloadPath + " already exists");
362+
} else {
363+
if (!downloadDirectory.mkdirs()) {
364+
final String errMsg = "Unable to create directory " + downloadPath + " to copy from Swift to cache.";
365+
s_logger.error(errMsg);
366+
return new CopyCmdAnswer(errMsg);
367+
}
361368
}
369+
362370
File destFile = SwiftUtil.getObject(swiftTO, downloadDirectory, srcData.getPath());
363371
return postProcessing(destFile, downloadPath, destPath, srcData, destData);
364372
} catch (Exception e) {

0 commit comments

Comments
 (0)