Skip to content

Commit 468c92e

Browse files
authored
template: don't return empty list on exit value fail (#20)
Addresses issue of re-downloading of templates when listvmtmplt.sh script fails (non 0 exit code) or timesout
1 parent 745a7b3 commit 468c92e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

services/secondary-storage/server/src/org/apache/cloudstack/storage/template/DownloadManagerImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,10 @@ private List<String> listVolumes(String rootdir) {
805805
script.add("-r", rootdir);
806806
ZfsPathParser zpp = new ZfsPathParser(rootdir);
807807
script.execute(zpp);
808+
if (script.getExitValue() != 0) {
809+
s_logger.error("Error while executing script " + script.toString());
810+
throw new CloudRuntimeException("Error while executing script " + script.toString());
811+
}
808812
result.addAll(zpp.getPaths());
809813
s_logger.info("found " + zpp.getPaths().size() + " volumes" + zpp.getPaths());
810814
return result;
@@ -817,6 +821,10 @@ private List<String> listTemplates(String rootdir) {
817821
script.add("-r", rootdir);
818822
ZfsPathParser zpp = new ZfsPathParser(rootdir);
819823
script.execute(zpp);
824+
if (script.getExitValue() != 0) {
825+
s_logger.error("Error while executing script " + script.toString());
826+
throw new CloudRuntimeException("Error while executing script " + script.toString());
827+
}
820828
result.addAll(zpp.getPaths());
821829
s_logger.info("found " + zpp.getPaths().size() + " templates" + zpp.getPaths());
822830
return result;

0 commit comments

Comments
 (0)