Search in sources :

Example 51 with VmTemplate

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

Example 52 with VmTemplate

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

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

Example 54 with VmTemplate

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

Example 55 with VmTemplate

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

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