use of org.ovirt.engine.core.common.scheduling.parameters.ClusterPolicyCRUDParameters in project ovirt-engine by oVirt.
the class BackendBalanceResource method remove.
@Override
public Response remove() {
ClusterPolicy entity = parent.getClusterPolicy();
updateEntityForRemove(entity, guid);
return performAction(ActionType.EditClusterPolicy, new ClusterPolicyCRUDParameters(entity.getId(), entity));
}
use of org.ovirt.engine.core.common.scheduling.parameters.ClusterPolicyCRUDParameters in project ovirt-engine by oVirt.
the class ClusterPolicyCRUDCommandTest method testCheckAddEditValidationsFailOnParameters.
@Test
public void testCheckAddEditValidationsFailOnParameters() {
Guid clusterPolicyId = new Guid("e754440b-76a6-4099-8235-4565ab4b5521");
ClusterPolicy clusterPolicy = new ClusterPolicy();
clusterPolicy.setId(clusterPolicyId);
HashMap<String, String> parameterMap = new HashMap<>();
parameterMap.put("fail?", "sure, fail!");
clusterPolicy.setParameterMap(parameterMap);
ClusterPolicyCRUDCommand command = new ClusterPolicyCRUDCommand(new ClusterPolicyCRUDParameters(clusterPolicyId, clusterPolicy), null) {
@Override
protected void executeCommand() {
}
};
command.schedulingManager = schedulingManager;
assertFalse(command.checkAddEditValidations());
}
use of org.ovirt.engine.core.common.scheduling.parameters.ClusterPolicyCRUDParameters in project ovirt-engine by oVirt.
the class BackendSchedulingPolicyResource method remove.
@Override
public Response remove() {
get();
Response performAction = null;
try {
performAction = performAction(ActionType.RemoveClusterPolicy, new ClusterPolicyCRUDParameters(asGuid(id), new QueryIdResolver<Guid>(QueryType.GetClusterPolicyById, IdQueryParameters.class).lookupEntity(asGuid(id))));
} catch (BackendFailureException e) {
log.error("Failed performing action", e);
}
return performAction;
}
use of org.ovirt.engine.core.common.scheduling.parameters.ClusterPolicyCRUDParameters in project ovirt-engine by oVirt.
the class ClusterPolicyListModel method onRemove.
public void onRemove() {
for (Object item : getSelectedItems()) {
ClusterPolicy clusterPolicy = (ClusterPolicy) item;
Frontend.getInstance().runAction(ActionType.RemoveClusterPolicy, new ClusterPolicyCRUDParameters(clusterPolicy.getId(), clusterPolicy));
}
setWindow(null);
// Execute search to keep list updated.
getSearchCommand().execute();
}
use of org.ovirt.engine.core.common.scheduling.parameters.ClusterPolicyCRUDParameters in project ovirt-engine by oVirt.
the class NewClusterPolicyModel method save.
private void save() {
if (getProgress() != null) {
return;
}
if (!validate()) {
return;
}
startProgress();
ClusterPolicy policy = new ClusterPolicy();
policy.setId(clusterPolicy.getId());
policy.setName(getName().getEntity());
policy.setDescription(getDescription().getEntity());
ArrayList<Guid> keys = new ArrayList<>();
for (PolicyUnit clusterPolicy : getUsedFilters()) {
keys.add(clusterPolicy.getId());
}
policy.setFilters(keys);
policy.setFilterPositionMap(getFilterPositionMap());
ArrayList<Pair<Guid, Integer>> pairs = new ArrayList<>();
for (Pair<PolicyUnit, Integer> pair : getUsedFunctions()) {
pairs.add(new Pair<>(pair.getFirst().getId(), pair.getSecond()));
}
policy.setFunctions(pairs);
policy.setBalance(getLoadBalanceList().getSelectedItem().getId());
policy.setParameterMap(KeyValueModel.convertProperties(getCustomPropertySheet().serialize()));
Frontend.getInstance().runAction(commandType == CommandType.Edit ? ActionType.EditClusterPolicy : ActionType.AddClusterPolicy, new ClusterPolicyCRUDParameters(policy.getId(), policy), result -> {
NewClusterPolicyModel.this.stopProgress();
if (result.getReturnValue().getSucceeded()) {
NewClusterPolicyModel.this.cancel();
}
});
}
Aggregations