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;
}
}
}
}
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);
}
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());
}
}
}
}
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());
}
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;
}
Aggregations