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>
This commit is contained in:
Remi Bergsma 2015-11-30 19:36:37 +01:00
commit df0797affd
1 changed files with 10 additions and 2 deletions

View File

@ -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) {