Search in sources :

Example 1 with AffinityGroupCRUDParameters

use of org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters in project ovirt-engine by oVirt.

the class AffinityGroupListModel method onRemove.

private void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (AffinityGroup affinityGroup : getSelectedItems()) {
        parameters.add(new AffinityGroupCRUDParameters(affinityGroup.getId(), affinityGroup));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveAffinityGroup, parameters, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : ArrayList(java.util.ArrayList) AffinityGroupCRUDParameters(org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) AffinityGroup(org.ovirt.engine.core.common.scheduling.AffinityGroup)

Example 2 with AffinityGroupCRUDParameters

use of org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters in project ovirt-engine by oVirt.

the class AffinityGroupModel method onSave.

void onSave() {
    if (!validate()) {
        return;
    }
    if (getProgress() != null) {
        return;
    }
    AffinityGroup group = getAffinityGroup();
    group.setName(getName().getEntity());
    group.setDescription(getDescription().getEntity());
    group.setClusterId(clusterId);
    // Save VM details
    group.setVmEnforcing(getVmAffinityEnforcing().getEntity());
    group.setVmAffinityRule(getVmAffinityRule().getSelectedItem());
    group.setVmIds(getVmsSelectionModel().getSelectedVmIds());
    // Save host details
    group.setVdsEnforcing(getHostAffinityEnforcing().getEntity());
    group.setVdsAffinityRule(getHostAffinityRule().getSelectedItem());
    group.setVdsIds(getHostsSelectionModel().getSelectedHostIds());
    startProgress();
    Frontend.getInstance().runAction(saveActionType, new AffinityGroupCRUDParameters(group.getId(), group), result -> {
        stopProgress();
        if (result != null && result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
            cancel();
        }
    }, this);
}
Also used : AffinityGroupCRUDParameters(org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters) AffinityGroup(org.ovirt.engine.core.common.scheduling.AffinityGroup)

Example 3 with AffinityGroupCRUDParameters

use of org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters in project ovirt-engine by oVirt.

the class BackendAffinityGroupResource method remove.

@Override
public Response remove() {
    get();
    AffinityGroupCRUDParameters params = new AffinityGroupCRUDParameters();
    params.setAffinityGroupId(asGuid(id));
    return performAction(ActionType.RemoveAffinityGroup, params);
}
Also used : AffinityGroupCRUDParameters(org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters)

Example 4 with AffinityGroupCRUDParameters

use of org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters in project ovirt-engine by oVirt.

the class BackendAffinityGroupVmsResource method add.

@Override
public Response add(Vm vm) {
    AffinityGroup affinityGroup = getEntity();
    affinityGroup.getVmIds().add(asGuid(vm.getId()));
    return performAction(ActionType.EditAffinityGroup, new AffinityGroupCRUDParameters(affinityGroup.getId(), affinityGroup));
}
Also used : AffinityGroupCRUDParameters(org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters) AffinityGroup(org.ovirt.engine.core.common.scheduling.AffinityGroup)

Example 5 with AffinityGroupCRUDParameters

use of org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters in project ovirt-engine by oVirt.

the class BackendAffinityGroupsResource method add.

@Override
public Response add(AffinityGroup affinityGroup) {
    org.ovirt.engine.core.common.scheduling.AffinityGroup backendEntity = getMapper(AffinityGroup.class, org.ovirt.engine.core.common.scheduling.AffinityGroup.class).map(affinityGroup, null);
    backendEntity.setClusterId(asGuid(clusterId));
    return performCreate(ActionType.AddAffinityGroup, new AffinityGroupCRUDParameters(null, backendEntity), new QueryIdResolver<Guid>(QueryType.GetAffinityGroupById, IdQueryParameters.class), true);
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) AffinityGroupCRUDParameters(org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters) Guid(org.ovirt.engine.core.compat.Guid) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup)

Aggregations

AffinityGroupCRUDParameters (org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters)5 AffinityGroup (org.ovirt.engine.core.common.scheduling.AffinityGroup)3 ArrayList (java.util.ArrayList)1 AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1