Search in sources :

Example 16 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class BackendUnmanagedNetworkResource method remove.

@Override
public Response remove() {
    get();
    HostSetupNetworksParameters parameters = new HostSetupNetworksParameters(hostId);
    parameters.setRemovedUnmanagedNetworks(Collections.singleton(id));
    return performAction(ActionType.HostSetupNetworks, parameters);
}
Also used : HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters)

Example 17 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class HostSetupNetworksModel method createHostSetupNetworksParameters.

public HostSetupNetworksParameters createHostSetupNetworksParameters() {
    HostSetupNetworksParameters result = new HostSetupNetworksParameters(getEntity().getId());
    for (NetworkAttachment attachment : hostSetupNetworksParametersData.getNetworkAttachments()) {
        attachment.setOverrideConfiguration(shouldSyncNetwork(attachment.getNetworkName()));
    }
    result.setNetworkAttachments(new ArrayList<NetworkAttachment>(hostSetupNetworksParametersData.getNetworkAttachments()));
    result.setRemovedNetworkAttachments(hostSetupNetworksParametersData.getRemovedNetworkAttachments());
    result.setCreateOrUpdateBonds(new ArrayList<CreateOrUpdateBond>(hostSetupNetworksParametersData.getBonds()));
    result.setRemovedBonds(new HashSet<>(hostSetupNetworksParametersData.getRemovedBonds()));
    result.setRemovedUnmanagedNetworks(hostSetupNetworksParametersData.getRemovedUnmanagedNetworks());
    result.setLabels(hostSetupNetworksParametersData.getLabels());
    result.setRemovedLabels(hostSetupNetworksParametersData.getRemovedLabels());
    return result;
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 18 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method testBondNotUpdatedAndRemovedSimultaneouslyNotValid.

@Test
public void testBondNotUpdatedAndRemovedSimultaneouslyNotValid() {
    HostSetupNetworksParameters params = new ParametersBuilder().addBonds(CreateOrUpdateBond.fromBond(bond)).addRemovedBonds(bond.getId()).build();
    HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(params).build();
    EngineMessage engineMessage = EngineMessage.BONDS_UPDATED_AND_REMOVED_SIMULTANEOUSLY;
    assertThat(validator.bondNotUpdatedAndRemovedSimultaneously(), failsWith(engineMessage, ReplacementUtils.getListVariableAssignmentString(engineMessage, Collections.singletonList(bond.getName()))));
}
Also used : HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) Test(org.junit.Test)

Example 19 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method testBondNotUpdatedAndRemovedSimultaneouslyValid.

@Test
public void testBondNotUpdatedAndRemovedSimultaneouslyValid() {
    HostSetupNetworksParameters params = new ParametersBuilder().addBonds(CreateOrUpdateBond.fromBond(bond)).addRemovedBonds(Guid.newGuid()).build();
    HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(params).build();
    assertThat(validator.bondNotUpdatedAndRemovedSimultaneously(), isValid());
}
Also used : HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) Test(org.junit.Test)

Example 20 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class UpdateNetworkAttachmentCommand method executeCommand.

@Override
protected void executeCommand() {
    HostSetupNetworksParameters params = new HostSetupNetworksParameters(getParameters().getVdsId());
    params.getNetworkAttachments().add(getParameters().getNetworkAttachment());
    ActionReturnValue returnValue = runInternalAction(ActionType.HostSetupNetworks, params);
    propagateFailure(returnValue);
    setSucceeded(returnValue.getSucceeded());
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters)

Aggregations

HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)24 Test (org.junit.Test)11 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)7 NicLabel (org.ovirt.engine.core.common.businessentities.network.NicLabel)7 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)5 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)4 Guid (org.ovirt.engine.core.compat.Guid)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)2 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)2 HostNic (org.ovirt.engine.api.model.HostNic)1 NetworkLabel (org.ovirt.engine.api.model.NetworkLabel)1 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 NicToIpv4AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction)1 NicToIpv6AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction)1