From c78f3984fee809386a72674daf8930458e62807d Mon Sep 17 00:00:00 2001 From: Min Chen Date: Thu, 6 Jun 2013 14:06:10 -0700 Subject: [PATCH] Fix a bug in copyFromS3ToNfs code about path. --- .../resource/NfsSecondaryStorageResource.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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());