use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.
the class BackendHostResource method setupNetworks.
@Override
public Response setupNetworks(Action action) {
// verify if host exists to handle 404 status code.
getVdsByVdsId();
HostSetupNetworksParameters parameters = toParameters(action);
return performAction(ActionType.HostSetupNetworks, parameters, action);
}
use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.
the class LabelNicCommand method createHostSetupNetworksParameters.
private HostSetupNetworksParameters createHostSetupNetworksParameters() {
HostSetupNetworksParameters params = new HostSetupNetworksParameters(getVdsId());
params.getLabels().add(new NicLabel(getNic().getId(), getNic().getName(), getLabel()));
return params;
}
use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.
the class AddNetworkAttachmentCommand method executeCommand.
@Override
protected void executeCommand() {
HostSetupNetworksParameters params = new HostSetupNetworksParameters(getParameters().getVdsId());
NetworkAttachment networkAttachment = getParameters().getNetworkAttachment();
params.getNetworkAttachments().add(networkAttachment);
// storing ids, so we're sure, that they were not mistakenly altered in HostSetupNetworks command.
Guid networkId = networkAttachment.getNetworkId();
Guid nicId = networkAttachment.getNicId();
ActionReturnValue returnValue = runInternalAction(ActionType.HostSetupNetworks, params);
if (returnValue.getSucceeded()) {
Guid createdAttachmentId = resolveCreatedAttachmentId(networkId, nicId);
getReturnValue().setActionReturnValue(createdAttachmentId);
} else {
propagateFailure(returnValue);
}
setSucceeded(returnValue.getSucceeded());
}
use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method nicActuallyExistsOrReferencesNewBondTrueButBondIsRemoved.
@Test
public void nicActuallyExistsOrReferencesNewBondTrueButBondIsRemoved() {
HostSetupNetworksParameters params = createHostSetupNetworksParams();
Guid removedBondId = Guid.newGuid();
params.getRemovedBonds().add(removedBondId);
NicLabelValidator validator = spy(createNicLabelValidator(params));
mockIsNicActuallyExistsOrReferencesNewBond(validator, true);
NicLabel nicLabel = new NicLabel();
nicLabel.setNicId(removedBondId);
nicLabel.setNicName("anyName");
assertThatNicActuallyExistsOrReferencesNewBondFailed(validator, nicLabel);
}
use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToValidBondNewBondValid.
@Test
public void labelBeingAttachedToValidBondNewBondValid() {
CreateOrUpdateBond createOrUpdateBond = new CreateOrUpdateBond();
createOrUpdateBond.setName("bond");
createOrUpdateBond.setSlaves(new HashSet<>(Arrays.asList("slave1", "slave2")));
HostSetupNetworksParameters params = createHostSetupNetworksParams();
params.getCreateOrUpdateBonds().add(createOrUpdateBond);
NicLabel nicLabel = new NicLabel(createOrUpdateBond.getId(), createOrUpdateBond.getName(), "lbl1");
assertThat(createNicLabelValidator(params, new ArrayList<>()).labelBeingAttachedToValidBond(nicLabel), isValid());
}
Aggregations