use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class AuditLogableBaseTest method getVmTemplateDefault.
@Test
public void getVmTemplateDefault() {
final VmTemplate t = b.getVmTemplate();
assertNull(t);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class BackendStorageDomainTemplatesResource method getEntitiesFromExportDomain.
@SuppressWarnings("unchecked")
@Override
protected Collection<VmTemplate> getEntitiesFromExportDomain() {
GetAllFromExportDomainQueryParameters params = new GetAllFromExportDomainQueryParameters(getDataCenterId(storageDomainId), storageDomainId);
Map<VmTemplate, List<DiskImage>> ret = getEntity(HashMap.class, QueryType.GetTemplatesFromExportDomain, params, "Templates under storage domain id : " + storageDomainId.toString());
return ret.keySet();
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class BackendVmPoolsResourceTest method getTemplateEntity.
protected org.ovirt.engine.core.common.businessentities.VmTemplate getTemplateEntity() {
VmTemplate entity = mock(VmTemplate.class);
when(entity.getId()).thenReturn(GUIDS[1]);
when(entity.getClusterId()).thenReturn(GUIDS[2]);
when(entity.getName()).thenReturn(NAMES[1]);
when(entity.getDescription()).thenReturn(DESCRIPTIONS[1]);
when(entity.getNumOfCpus()).thenReturn(8);
when(entity.getNumOfSockets()).thenReturn(2);
when(entity.getDefaultDisplayType()).thenReturn(DisplayType.vga);
when(entity.getNumOfMonitors()).thenReturn(2);
when(entity.getVmType()).thenReturn(VmType.Server);
return entity;
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class GetLatestTemplateInChainQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VmTemplate vmt;
vmt = vmTemplateDao.getTemplateWithLatestVersionInChain(getParameters().getId());
if (vmt != null) {
vmTemplateHandler.updateDisksFromDb(vmt);
vmHandler.updateVmInitFromDB(vmt, true);
}
getQueryReturnValue().setReturnValue(vmt);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class ExportVmCommand method checkTemplateInStorageDomain.
public static boolean checkTemplateInStorageDomain(Guid storagePoolId, Guid storageDomainId, final Guid tmplId, EngineContext engineContext) {
GetAllFromExportDomainQueryParameters tempVar = new GetAllFromExportDomainQueryParameters(storagePoolId, storageDomainId);
QueryReturnValue qretVal = Backend.getInstance().runInternalQuery(QueryType.GetTemplatesFromExportDomain, tempVar, engineContext);
if (qretVal.getSucceeded()) {
if (!VmTemplateHandler.BLANK_VM_TEMPLATE_ID.equals(tmplId)) {
Map<VmTemplate, List<DiskImage>> templates = qretVal.getReturnValue();
return templates.keySet().stream().anyMatch(vmTemplate -> vmTemplate.getId().equals(tmplId));
} else {
return true;
}
}
return false;
}
Aggregations