Search in sources :

Example 41 with VmTemplate

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);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 42 with VmTemplate

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();
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ArrayList(java.util.ArrayList) List(java.util.List) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters)

Example 43 with VmTemplate

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;
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 44 with VmTemplate

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);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 45 with VmTemplate

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;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) List(java.util.List) ArrayList(java.util.ArrayList) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters)

Aggregations

VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)149 ArrayList (java.util.ArrayList)42 Guid (org.ovirt.engine.core.compat.Guid)40 Test (org.junit.Test)30 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)23 HashMap (java.util.HashMap)22 List (java.util.List)20 VM (org.ovirt.engine.core.common.businessentities.VM)19 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)16 Map (java.util.Map)13 QueryType (org.ovirt.engine.core.common.queries.QueryType)13 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)12 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)11 Frontend (org.ovirt.engine.ui.frontend.Frontend)10 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)9 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)9 Collection (java.util.Collection)8 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)8