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);
}
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;
}
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()))));
}
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());
}
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());
}
Aggregations