@Override public void updateStoreRoleToCachce(long storeId) { SearchCriteria<TemplateDataStoreVO> sc = storeSearch.create(); sc.setParameters("store_id", storeId); sc.setParameters("destroyed", false); List<TemplateDataStoreVO> tmpls = listBy(sc); if (tmpls != null) { s_logger.info("Update to cache store role for " + tmpls.size() + " entries in template_store_ref"); for (TemplateDataStoreVO tmpl : tmpls) { tmpl.setDataStoreRole(DataStoreRole.ImageCache); update(tmpl.getId(), tmpl); } } }
@Override public TemplateDataStoreVO createTemplateDirectDownloadEntry(long templateId, Long size) { TemplateDataStoreVO templateDataStoreVO = new TemplateDataStoreVO(); templateDataStoreVO.setTemplateId(templateId); templateDataStoreVO.setDataStoreRole(DataStoreRole.Image); templateDataStoreVO.setState(State.Ready); templateDataStoreVO.setDownloadState(Status.BYPASSED); templateDataStoreVO.setSize(size == null ? 0l : size); return templateDataStoreVO; }
@Override public void addSystemVMTemplatesToSecondary(DataStore store) { long storeId = store.getId(); List<VMTemplateVO> rtngTmplts = _templateDao.listAllSystemVMTemplates(); for (VMTemplateVO tmplt : rtngTmplts) { TemplateDataStoreVO tmpltStore = _vmTemplateStoreDao.findByStoreTemplate(storeId, tmplt.getId()); if (tmpltStore == null) { tmpltStore = new TemplateDataStoreVO(storeId, tmplt.getId(), new Date(), 100, Status.DOWNLOADED, null, null, null, TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH + tmplt.getId() + '/', tmplt.getUrl()); tmpltStore.setSize(0L); tmpltStore.setPhysicalSize(0); // no size information for // pre-seeded system vm templates tmpltStore.setDataStoreRole(store.getRole()); _vmTemplateStoreDao.persist(tmpltStore); } } }
vmTemplateStore = new TemplateDataStoreVO(store.getId(), template.getId(), new Date(), 0, Status.NOT_DOWNLOADED, null, null, "jobid0000", null, template.getUri()); vmTemplateStore.setDataStoreRole(store.getRole()); vmTemplateStore = _vmTemplateStoreDao.persist(vmTemplateStore); } else if ((vmTemplateStore.getJobId() != null) && (vmTemplateStore.getJobId().length() > 2)) {
tmpltStore.setSize(tmpltInfo.getSize()); tmpltStore.setPhysicalSize(tmpltInfo.getPhysicalSize()); tmpltStore.setDataStoreRole(store.getRole()); _vmTemplateStoreDao.persist(tmpltStore);
ts.setTemplateId(tmpl.getTemplateId()); ts.setDataStoreId(storeId); ts.setDataStoreRole(DataStoreRole.Image); ts.setState(tmpl.getState()); ts.setDownloadPercent(tmpl.getDownloadPercent());
ts.setTemplateId(obj.getId()); ts.setDataStoreId(dataStore.getId()); ts.setDataStoreRole(dataStore.getRole()); String installPath = TemplateConstants.DEFAULT_TMPLT_ROOT_DIR + "/" + TemplateConstants.DEFAULT_TMPLT_FIRST_LEVEL_DIR +