Fix a bug in copyFromS3ToNfs code about path.

This commit is contained in:
Min Chen 2013-06-06 14:06:10 -07:00
parent 4e404953ad
commit c78f3984fe

View File

@ -245,22 +245,13 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
s_logger.debug("Directory " + downloadPath + " already exists");
}
List<File> files = getDirectory(s3, s3.getBucketName(), destPath, downloadDirectory, new FileNamingStrategy() {
File destFile = S3Utils.getFile(s3, s3.getBucketName(), srcData.getPath(), downloadDirectory, new FileNamingStrategy() {
@Override
public String determineFileName(final String key) {
return substringAfterLast(key, S3Utils.SEPARATOR);
}
});
// find out template name
File destFile = null;
for (File f : files) {
if (!f.getName().endsWith(".properties")) {
destFile = f;
break;
}
}
if (destFile == null) {
return new CopyCmdAnswer("Can't find template");
}
@ -335,6 +326,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
protected Answer copySnapshotToTemplateFromNfsToNfsXenserver(CopyCommand cmd, SnapshotObjectTO srcData, NfsTO srcDataStore,
TemplateObjectTO destData, NfsTO destDataStore) {
String srcMountPoint = this.getRootDir(srcDataStore.getUrl());