CLOUDSTACK-3513:[Automation] Failed to copy iso and template between

zones. Failed to pass generated copy url to DownloadCommand.
This commit is contained in:
Min Chen 2013-07-22 16:09:57 -07:00
parent 3d05fb0b3e
commit 0fb3286cb1
2 changed files with 17 additions and 1 deletions

View File

@ -100,6 +100,13 @@ public class TemplateDataFactoryImpl implements TemplateDataFactory {
@Override
public TemplateInfo getTemplate(DataObject obj, DataStore store) {
return this.getTemplate(obj.getId(), store);
TemplateObject tmpObj = (TemplateObject) this.getTemplate(obj.getId(), store);
// carry over url set in passed in data object, for copyTemplate case
// where url is generated on demand and not persisted in DB.
// need to think of a more generic way to pass these runtime information
// carried through DataObject post 4.2
TemplateObject origTmpl = (TemplateObject) obj;
tmpObj.setUrl(origTmpl.getUrl());
return tmpObj;
}
}

View File

@ -55,6 +55,7 @@ import com.cloud.agent.api.storage.Proxy;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.storage.RegisterVolumePayload;
import com.cloud.storage.VMTemplateStorageResourceAssoc;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import com.cloud.storage.Volume;
@ -215,7 +216,15 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
if (isTemplateUpdateable(templateId, store.getId())) {
if (template != null && template.getUri() != null) {
initiateTemplateDownload(template, callback);
} else {
s_logger.info("Template url is null, cannot download");
DownloadAnswer ans = new DownloadAnswer("Template url is null", VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR.UNKNOWN);
callback.complete(ans);
}
} else {
s_logger.info("Template download is already in progress or already downloaded");
DownloadAnswer ans = new DownloadAnswer("Template download is already in progress or already downloaded", VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR.UNKNOWN);
callback.complete(ans);
}
}