diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index d6a2af4d5c7..228024e4edb 100755 --- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -245,22 +245,13 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S s_logger.debug("Directory " + downloadPath + " already exists"); } - List 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());