use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class BackendExportDomainDiskResourceTest method getVmTemplateEntity.
protected VmTemplate getVmTemplateEntity(int index) {
VmTemplate vm = setUpEntityExpectations(mock(VmTemplate.class), index);
when(vm.getDiskTemplateMap()).thenReturn(getDiskMap());
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class IconLoader method updateVmStaticTable.
private void updateVmStaticTable() {
for (VmStatic vmStatic : vmStaticDao.getAllWithoutIcon()) {
setIconsByOs(vmStatic);
vmStaticDao.update(vmStatic);
}
for (VmTemplate vmTemplate : vmTemplateDao.getAllWithoutIcon()) {
setIconsByOs(vmTemplate);
vmTemplateDao.update(vmTemplate);
}
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class GetVmTemplatesByBaseTemplateIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VmTemplate> templateList = vmTemplateDao.getTemplateVersionsForBaseTemplate(getParameters().getId());
if (templateList != null) {
VmTemplate baseTemplate = vmTemplateDao.get(getParameters().getId(), getUserID(), getParameters().isFiltered());
if (baseTemplate != null) {
templateList.add(baseTemplate);
}
// Load VmInit and disks
for (VmTemplate template : templateList) {
vmHandler.updateVmInitFromDB(template, true);
vmTemplateHandler.updateDisksFromDb(template);
}
}
getQueryReturnValue().setReturnValue(templateList);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class GetVmTemplatesByStoragePoolIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VmTemplate> templateList = vmTemplateDao.getAllForStoragePool(getParameters().getId());
// Load VmInit
for (VmTemplate template : templateList) {
vmHandler.updateVmInitFromDB(template, true);
}
VmTemplate blank = vmTemplateDao.get(VmTemplateHandler.BLANK_VM_TEMPLATE_ID);
if (!templateList.contains(blank)) {
vmHandler.updateVmInitFromDB(blank, true);
templateList.add(0, blank);
}
getQueryReturnValue().setReturnValue(templateList);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class GetVmTemplatesFromStorageDomainQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VmTemplate> returnValue = vmTemplateDao.getAllForStorageDomain(getParameters().getId(), getUserID(), getParameters().isFiltered());
if (getParameters().isWithDisks()) {
for (VmTemplate template : returnValue) {
vmTemplateHandler.updateDisksFromDb(template);
Collections.sort(template.getDiskList(), new DiskByDiskAliasComparator());
}
}
Collections.sort(returnValue, Comparator.comparing(VmTemplate::getActualDiskSize).reversed());
getQueryReturnValue().setReturnValue(returnValue);
}
Aggregations