Search in sources :

Example 11 with CpuQos

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

the class UpdateCpuProfileCommand method executeCommand.

@Override
protected void executeCommand() {
    // Chcek if qos has changed
    Guid oldQos = cpuProfileDao.get(getProfileId()).getQosId();
    Guid newQos = getProfile().getQosId();
    super.executeCommand();
    // QoS did not change
    if (Objects.equals(oldQos, newQos)) {
        return;
    }
    CpuQos qos;
    if (newQos == null || Guid.Empty.equals(newQos)) {
        qos = new CpuQos();
        qos.setCpuLimit(100);
    } else {
        qos = cpuQosDao.get(newQos);
    }
    // Update policies of all running vms
    if (getSucceeded()) {
        vmSlaPolicyUtils.refreshRunningVmsWithCpuProfile(getProfileId(), qos);
    }
}
Also used : CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) Guid(org.ovirt.engine.core.compat.Guid)

Example 12 with CpuQos

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

the class CpuQosDaoTest method generateNewEntity.

@Override
protected CpuQos generateNewEntity() {
    CpuQos cpuQos = new CpuQos();
    cpuQos.setId(Guid.newGuid());
    cpuQos.setName("qos_d");
    cpuQos.setDescription("desc3");
    cpuQos.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
    cpuQos.setCpuLimit(40);
    return cpuQos;
}
Also used : CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos)

Example 13 with CpuQos

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

the class QosRangeValidatorTest method validCpuMessage.

@Test
public void validCpuMessage() {
    CpuQos qos = new CpuQos();
    qos.setCpuLimit(OUT_OF_RANGE);
    List<String> validationMessages = ValidationUtils.validateInputs(Arrays.asList(new Class<?>[] { Default.class }), qos);
    assertValidateMsgCount(validationMessages, "$range 1-100", 1);
    assertValidateMsgCount(validationMessages, EngineMessage.ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES.name(), 1);
}
Also used : CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) Default(javax.validation.groups.Default) Test(org.junit.Test)

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