Search in sources :

Example 1 with NetworkNotInSyncPredicate

use of org.ovirt.engine.core.bll.network.predicate.NetworkNotInSyncPredicate in project ovirt-engine by oVirt.

the class SyncAllHostNetworksCommand method generateSyncAllHostNetworksParameters.

private PersistentHostSetupNetworksParameters generateSyncAllHostNetworksParameters() {
    PersistentHostSetupNetworksParameters parameters = new PersistentHostSetupNetworksParameters(getVdsId());
    QueryReturnValue returnValue = runInternalQuery(QueryType.GetNetworkAttachmentsByHostId, new IdQueryParameters(getVdsId()));
    List<NetworkAttachment> networkAttachments = returnValue.getReturnValue();
    List<NetworkAttachment> unSyncNetworkAttachments = networkAttachments.stream().filter(new NetworkNotInSyncPredicate()).collect(Collectors.toList());
    for (NetworkAttachment networkAttachment : unSyncNetworkAttachments) {
        networkAttachment.setOverrideConfiguration(true);
    }
    parameters.setNetworkAttachments(unSyncNetworkAttachments);
    parameters.setSequence(parameters.getSequence() + 1);
    parameters.setTotal(parameters.getTotal() + 1);
    return parameters;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) PersistentHostSetupNetworksParameters(org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters) NetworkNotInSyncPredicate(org.ovirt.engine.core.bll.network.predicate.NetworkNotInSyncPredicate) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Aggregations

NetworkNotInSyncPredicate (org.ovirt.engine.core.bll.network.predicate.NetworkNotInSyncPredicate)1 PersistentHostSetupNetworksParameters (org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters)1 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1