Search in sources :

Example 6 with AddNetworkStoragePoolParameters

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

the class LabelNetworkCommand method executeCommand.

@Override
protected void executeCommand() {
    getNetwork().setLabel(getLabel());
    ActionReturnValue result = runInternalAction(ActionType.UpdateNetwork, new AddNetworkStoragePoolParameters(getNetwork().getDataCenterId(), getNetwork()));
    if (!result.getSucceeded()) {
        propagateFailure(result);
    }
    getReturnValue().setActionReturnValue(getLabel());
    setSucceeded(result.getSucceeded());
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) AddNetworkStoragePoolParameters(org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)

Example 7 with AddNetworkStoragePoolParameters

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

the class UnlabelNetworkCommand method executeCommand.

@Override
protected void executeCommand() {
    getNetwork().setLabel(null);
    ActionReturnValue result = runInternalAction(ActionType.UpdateNetwork, new AddNetworkStoragePoolParameters(getNetwork().getDataCenterId(), getNetwork()));
    if (!result.getSucceeded()) {
        propagateFailure(result);
    }
    setSucceeded(result.getSucceeded());
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) AddNetworkStoragePoolParameters(org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)

Example 8 with AddNetworkStoragePoolParameters

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

the class AutodefineExternalNetworkCommand method runAutodefineForOneProvider.

// Acquire lock for every provider and run auto-define inside this lock
private void runAutodefineForOneProvider(Guid providerId, int index) {
    try (EngineLock lock = acquireLockForProvider(providerId)) {
        Network externalNetwork = createExternalNetwork(calcExternalNetworkName(index), providerId);
        AddNetworkStoragePoolParameters storagePoolParameters = new AddNetworkStoragePoolParameters(getNetwork().getStoragePoolId(), externalNetwork);
        storagePoolParameters.setNetworkClusterList(networkHelper.createNetworkClusters(clustersByProvider.get(providerId)));
        storagePoolParameters.setVnicProfilePublicUse(false);
        runInternalAction(ActionType.AddNetworkOnProvider, storagePoolParameters);
    }
}
Also used : AddNetworkStoragePoolParameters(org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 9 with AddNetworkStoragePoolParameters

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

the class BackendNetworksResource method add.

@Override
public Response add(Network network) {
    validateParameters(network, getRequiredAddFields());
    org.ovirt.engine.core.common.businessentities.network.Network entity = map(network);
    AddNetworkStoragePoolParameters params = getAddParameters(network, entity);
    return performCreate(network.isSetExternalProvider() ? ActionType.AddNetworkOnProvider : addAction, params, new DataCenterNetworkIdResolver(network.getName(), params.getStoragePoolId().toString()));
}
Also used : AddNetworkStoragePoolParameters(org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)

Aggregations

AddNetworkStoragePoolParameters (org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)9 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 Network (org.ovirt.engine.core.common.businessentities.network.Network)2 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)2 DataCenter (org.ovirt.engine.api.model.DataCenter)1 OpenStackNetwork (org.ovirt.engine.api.model.OpenStackNetwork)1 Guid (org.ovirt.engine.core.compat.Guid)1 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)1