Search in sources :

Example 1 with CpuQos

use of org.ovirt.engine.core.common.businessentities.qos.CpuQos in project ovirt-engine by oVirt.

the class CpuProfileBaseModel method postInitQosList.

@Override
protected void postInitQosList(List<CpuQos> qosList) {
    qosList.add(0, EMPTY_QOS);
    getQos().setItems(qosList);
    if (getDefaultQosId() != null) {
        for (CpuQos cpuQos : qosList) {
            if (getDefaultQosId().equals(cpuQos.getId())) {
                getQos().setSelectedItem(cpuQos);
                break;
            }
        }
    }
}
Also used : CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos)

Example 2 with CpuQos

use of org.ovirt.engine.core.common.businessentities.qos.CpuQos in project ovirt-engine by oVirt.

the class RemoveCpuQosCommand method executeCommand.

@Override
protected void executeCommand() {
    List<Guid> vmIds = vmSlaPolicyUtils.getRunningVmsWithCpuQos(getQosId());
    super.executeCommand();
    // After successful command, refresh qos
    CpuQos unlimitedQos = new CpuQos();
    unlimitedQos.setCpuLimit(100);
    vmSlaPolicyUtils.refreshVmsCpuQos(vmIds, unlimitedQos);
}
Also used : CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) Guid(org.ovirt.engine.core.compat.Guid)

Example 3 with CpuQos

use of org.ovirt.engine.core.common.businessentities.qos.CpuQos in project ovirt-engine by oVirt.

the class AbstractBackendCpuProfilesResource method handleQosDataCenterLinks.

/**
 * used to set qos's href (requires dc id).
 */
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
    if (!qosMap.isEmpty()) {
        List<CpuQos> list = getBackendCollection(CpuQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.CPU));
        for (CpuQos cpuQos : list) {
            Qos qos = qosMap.get(cpuQos.getId());
            if (qos != null) {
                qos.setDataCenter(new DataCenter());
                qos.getDataCenter().setId(cpuQos.getStoragePoolId().toString());
            }
        }
    }
}
Also used : QosQueryParameterBase(org.ovirt.engine.core.common.queries.QosQueryParameterBase) DataCenter(org.ovirt.engine.api.model.DataCenter) Qos(org.ovirt.engine.api.model.Qos) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos)

Example 4 with CpuQos

use of org.ovirt.engine.core.common.businessentities.qos.CpuQos in project ovirt-engine by oVirt.

the class CpuProfilesListModelTable method initTable.

@Override
public void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<CpuProfile> nameColumn = new AbstractTextColumn<CpuProfile>() {

        @Override
        public String getValue(CpuProfile object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.profileNameLabel(), "200px");
    nameColumn.makeSortable();
    AbstractTextColumn<CpuProfile> descriptionColumn = new AbstractTextColumn<CpuProfile>() {

        @Override
        public String getValue(CpuProfile object) {
            return object.getDescription();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.profileDescriptionLabel(), "200px");
    descriptionColumn.makeSortable();
    AbstractTextColumn<CpuProfile> qosColumn = new AbstractTextColumn<CpuProfile>() {

        @Override
        public String getValue(CpuProfile object) {
            String name = constants.unlimitedQos();
            if (object.getQosId() != null) {
                CpuQos cpuQos = getModel().getQos(object.getQosId());
                if (cpuQos != null) {
                    name = cpuQos.getName();
                }
            }
            return name;
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(qosColumn, constants.cpuQosName(), "200px");
    qosColumn.makeSortable();
    // Add selection listener
    getModel().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updatePermissionPanel());
    getModel().getItemsChangedEvent().addListener((ev, sender, args) -> updatePermissionPanel());
}
Also used : CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos)

Example 5 with CpuQos

use of org.ovirt.engine.core.common.businessentities.qos.CpuQos in project ovirt-engine by oVirt.

the class CpuQosDaoImpl method getCpuQosByVmIds.

@Override
public Map<Guid, CpuQos> getCpuQosByVmIds(Collection<Guid> vmIds) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_ids", createArrayOfUUIDs(vmIds));
    List<Pair<Guid, CpuQos>> pairs = getCallsHandler().executeReadList("GetQosByVmIds", cpuQosMultipleMapper, parameterSource);
    Map<Guid, CpuQos> qosMap = new HashMap<>();
    for (Pair<Guid, CpuQos> pair : pairs) {
        qosMap.put(pair.getFirst(), pair.getSecond());
    }
    return qosMap;
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) HashMap(java.util.HashMap) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair)

Aggregations

CpuQos (org.ovirt.engine.core.common.businessentities.qos.CpuQos)13 Guid (org.ovirt.engine.core.compat.Guid)5 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 Pair (org.ovirt.engine.core.common.utils.Pair)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Callable (java.util.concurrent.Callable)1 Collectors (java.util.stream.Collectors)1 Observes (javax.enterprise.event.Observes)1 Instance (javax.enterprise.inject.Instance)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1