Skip to content

Commit c67e7d0

Browse files
committed
standardize register ISO response
1 parent a4cca72 commit c67e7d0

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,15 @@ protected TemplateJoinDaoImpl() {
164164

165165
private String getTemplateStatus(TemplateJoinVO template) {
166166
if (template.getDownloadState() == Status.DOWNLOADED) {
167-
return "Download Complete";
167+
return "Successfully Installed";
168168
}
169169
String templateStatus = "Processing";
170170
if (template.getDownloadState() == Status.DOWNLOAD_IN_PROGRESS) {
171171
if (template.getDownloadPercent() == 100) {
172172
templateStatus = "Installing Template";
173+
if (template.getFormat() == Storage.ImageFormat.ISO) {
174+
templateStatus = "Installing ISO";
175+
}
173176
} else {
174177
templateStatus = template.getDownloadPercent() + "% Downloaded";
175178
}
@@ -506,24 +509,9 @@ public TemplateResponse newIsoResponse(TemplateJoinVO iso, ResponseView view) {
506509
// If the user is an admin, add the template download status
507510
if (isAdmin || caller.getId() == iso.getAccountId()) {
508511
// add download status
509-
if (iso.getDownloadState() != Status.DOWNLOADED) {
510-
String isoStatus = "Processing";
511-
if (iso.getDownloadState() == Status.DOWNLOADED) {
512-
isoStatus = "Download Complete";
513-
} else if (iso.getDownloadState() == Status.DOWNLOAD_IN_PROGRESS) {
514-
if (iso.getDownloadPercent() == 100) {
515-
isoStatus = "Installing ISO";
516-
} else {
517-
isoStatus = iso.getDownloadPercent() + "% Downloaded";
518-
}
519-
} else if (iso.getDownloadState() == Status.BYPASSED) {
520-
isoStatus = "Bypassed Secondary Storage";
521-
} else {
522-
isoStatus = iso.getErrorString();
523-
}
524-
isoResponse.setStatus(isoStatus);
525-
} else {
526-
isoResponse.setStatus("Successfully Installed");
512+
String templateStatus = getTemplateStatus(iso);
513+
if (templateStatus != null) {
514+
isoResponse.setStatus(templateStatus);
527515
}
528516
isoResponse.setUrl(iso.getUrl());
529517
List<TemplateDataStoreVO> isosInStore = _templateStoreDao.listByTemplateNotBypassed(iso.getId());

0 commit comments

Comments
 (0)