CLOUDSTACK-5900: Failed to delete template/ISO that failed to download.

(cherry picked from commit ae22d1990e)

Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
This commit is contained in:
Sanjay Tripathi 2014-01-29 13:52:03 +05:30 committed by Animesh Chaturvedi
parent e089b91385
commit 16dbb20b5d
1 changed files with 6 additions and 1 deletions

View File

@ -1740,7 +1740,12 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
parent += File.separator;
}
String absoluteTemplatePath = parent + relativeTemplatePath;
File tmpltParent = new File(absoluteTemplatePath).getParentFile();
File tmpltParent;
if(absoluteTemplatePath.endsWith(String.valueOf(obj.getId()))) {
tmpltParent = new File(absoluteTemplatePath);
} else {
tmpltParent = new File(absoluteTemplatePath).getParentFile();
}
String details = null;
if (!tmpltParent.exists()) {
details = "template parent directory " + tmpltParent.getName() + " doesn't exist";