use of org.ovirt.engine.core.common.action.VmNicFilterParameterParameters in project ovirt-engine by oVirt.
the class BackendVmNicFilterParametersResource method add.
@Override
public Response add(NetworkFilterParameter parameter) {
validateParameters(parameter, "value");
VmNicFilterParameter vmNicFilterParameter = map(parameter);
vmNicFilterParameter.setVmInterfaceId(nicId);
return performCreate(ActionType.AddVmNicFilterParameter, new VmNicFilterParameterParameters(vmId, vmNicFilterParameter), new NicNetworkFilterParameterResolver(parameter.getName()));
}
use of org.ovirt.engine.core.common.action.VmNicFilterParameterParameters in project ovirt-engine by oVirt.
the class AddVmInterfaceCommand method saveNetworkFilterParameters.
protected void saveNetworkFilterParameters() {
if (getParameters().getFilterParameters() != null) {
for (VmNicFilterParameter parameter : getParameters().getFilterParameters()) {
parameter.setVmInterfaceId(getInterface().getId());
runInternalAction(ActionType.AddVmNicFilterParameter, new VmNicFilterParameterParameters(getParameters().getVmId(), parameter));
}
}
}
use of org.ovirt.engine.core.common.action.VmNicFilterParameterParameters in project ovirt-engine by oVirt.
the class UpdateVmInterfaceCommand method saveNetworkFilterParameters.
protected void saveNetworkFilterParameters() {
List<VmNicFilterParameter> newParameters = getParameters().getFilterParameters();
if (newParameters != null) {
List<VmNicFilterParameter> savedParameters = runInternalQuery(QueryType.GetVmInterfaceFilterParametersByVmInterfaceId, new IdQueryParameters(getInterface().getId())).getReturnValue();
for (VmNicFilterParameter parameter : newParameters) {
boolean toUpdate = savedParameters.stream().anyMatch(saved -> Objects.equals(parameter.getId(), saved.getId()));
if (toUpdate) {
runInternalAction(ActionType.UpdateVmNicFilterParameter, new VmNicFilterParameterParameters(getParameters().getVmId(), parameter));
} else {
parameter.setVmInterfaceId(getInterface().getId());
runInternalAction(ActionType.AddVmNicFilterParameter, new VmNicFilterParameterParameters(getParameters().getVmId(), parameter));
}
}
for (VmNicFilterParameter parameter : savedParameters) {
if (newParameters.stream().noneMatch(newParameter -> Objects.equals(parameter.getId(), newParameter.getId()))) {
runInternalAction(ActionType.RemoveVmNicFilterParameter, new RemoveVmNicFilterParameterParameters(getParameters().getVmId(), parameter.getId()));
}
}
}
}
Aggregations