use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class NetworkQosDaoTest method testGetNetworkQos.
/**
* Ensures that retrieving VDS by ID works as expected.
*/
@Test
public void testGetNetworkQos() {
NetworkQoS result = dao.get(qosAId);
NetworkQoS trueA = new NetworkQoS();
trueA.setId(qosAId);
trueA.setName("network_qos_a");
trueA.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
trueA.setInboundAverage(1000);
trueA.setInboundPeak(2000);
trueA.setInboundBurst(500);
trueA.setOutboundAverage(1000);
trueA.setOutboundPeak(2000);
trueA.setOutboundBurst(500);
assertNotNull(result);
assertEquals(trueA, result);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class NetworkQosDaoTest method testUpdateNetworkQos.
/**
* test update
*/
@Test
public void testUpdateNetworkQos() {
NetworkQoS newB = new NetworkQoS();
newB.setId(qosBId);
newB.setName("newB");
newB.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
newB.setInboundAverage(30);
newB.setInboundPeak(30);
newB.setInboundBurst(30);
newB.setOutboundAverage(30);
newB.setOutboundPeak(30);
newB.setOutboundBurst(30);
dao.update(newB);
NetworkQoS afterUpdate = dao.get(qosBId);
assertEquals(newB, afterUpdate);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class NetworkQosDaoTest method checkNameUniquness.
public void checkNameUniquness(String name) {
NetworkQoS entity = new NetworkQoS();
entity.setId(Guid.newGuid());
entity.setName(name);
entity.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
dao.save(entity);
entity.setId(Guid.newGuid());
dao.save(entity);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class QosMapper method mapNetworkQosToModel.
private static void mapNetworkQosToModel(QosBase entity, Qos model) {
NetworkQoS networkQos = verifyAndCast(entity, NetworkQoS.class);
if (networkQos != null) {
model.setInboundAverage(networkQos.getInboundAverage());
model.setInboundPeak(networkQos.getInboundPeak());
model.setInboundBurst(networkQos.getInboundBurst());
model.setOutboundAverage(networkQos.getOutboundAverage());
model.setOutboundPeak(networkQos.getOutboundPeak());
model.setOutboundBurst(networkQos.getOutboundBurst());
}
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class VmInfoBuildUtils method addQosForDevice.
private void addQosForDevice(Map<String, Object> struct, VnicProfile vnicProfile) {
Guid qosId = vnicProfile.getNetworkQosId();
@SuppressWarnings("unchecked") Map<String, Object> specParams = (Map<String, Object>) struct.get(VdsProperties.SpecParams);
if (specParams == null) {
specParams = new HashMap<>();
struct.put(VdsProperties.SpecParams, specParams);
}
NetworkQoS networkQoS = (qosId == null) ? new NetworkQoS() : networkQosDao.get(qosId);
NetworkQosMapper qosMapper = new NetworkQosMapper(specParams, VdsProperties.QOS_INBOUND, VdsProperties.QOS_OUTBOUND);
qosMapper.serialize(networkQoS);
}
Aggregations