/** * Create the XenServer tools ISO entry in the database. * If there is already an entry with 'isoName' equals to {@value #xenServerIsoName} , we update its 'displayText' to {@value #xenServerIsoDisplayText}. * Otherwise, we create a new entry. */ protected void createXenServerToolsIsoEntryInDatabase() { VMTemplateVO tmplt = _tmpltDao.findByTemplateName(xenServerIsoName); if (tmplt == null) { long id = _tmpltDao.getNextInSequence(Long.class, "id"); VMTemplateVO template = VMTemplateVO.createPreHostIso(id, xenServerIsoName, xenServerIsoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, null, xenServerIsoDisplayText, false, 1, false, HypervisorType.XenServer); _tmpltDao.persist(template); } else { long id = tmplt.getId(); tmplt.setTemplateType(TemplateType.PERHOST); tmplt.setUrl(null); tmplt.setDisplayText(xenServerIsoDisplayText); _tmpltDao.update(id, tmplt); } }
_tmpltDao.update(template.getId(), updatedTemplate); updatedTemplate.setPublicTemplate(false); updatedTemplate.setFeatured(false); _tmpltDao.update(template.getId(), updatedTemplate); _launchPermissionDao.removeAllPermissions(id); _messageBus.publish(_name, TemplateManager.MESSAGE_RESET_TEMPLATE_PERMISSION_EVENT, PublishScope.LOCAL, template.getId());
_vmTemplateDao.update(vmTemplateVO.getId(), vmTemplateVO);
_templateDao.update(tmpTemplate.getId(), templateUpdate); stateMachine.transitTo(tmpTemplate, VirtualMachineTemplate.Event.OperationSucceeded, null, _templateDao); _resourceLimitMgr.incrementResourceCount(template.getAccountId(), Resource.ResourceType.secondary_storage, answer.getVirtualSize());
if (imageStores == null || imageStores.size() == 0) { template.setState(VirtualMachineTemplate.State.Inactive); _templateDao.update(template.getId(), template);
_tmpltDao.update(templateId, template);
_vmTemplateDao.update(destData.getId(), templateDataStoreVO);
_tmpltDao.update(id, template);
imageDao.update(templateVO.getId(), templateVO);