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

Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
Logan B 2014-06-20 13:27:32 -04:00 committed by Daan Hoogland
parent 60f4203cbc
commit 736bf540e8
1 changed files with 7 additions and 5 deletions

View File

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