Search in sources :

Example 1 with Network

use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.

the class NetworkMonitoringHelper method determineProblematicNics.

/**
 * Determine which of the given NICs is problematic - a problematic NIC is considered to be a NIC which it's state
 * is down and it is the underlying interface of a required network.
 *
 * @param interfaces
 *            The NICs to check.
 * @param clusterNetworks
 *            The cluster's networks.
 * @return A pair of a list of the names of the NICs which are problematic, and a list of the names of the networks
 *         which are required by these NICs.
 */
public static Map<String, Set<String>> determineProblematicNics(List<VdsNetworkInterface> interfaces, List<Network> clusterNetworks) {
    Map<String, Set<String>> brokenNicsToNetworks = new HashMap<>();
    Map<String, Network> networksByName = NetworkUtils.networksByName(clusterNetworks);
    for (VdsNetworkInterface iface : interfaces) {
        if (isRequiredInterfaceDown(networksByName, interfaces, iface)) {
            String baseNicName = NetworkCommonUtils.stripVlan(iface);
            Set<String> networks = brokenNicsToNetworks.get(baseNicName);
            if (networks == null) {
                networks = new HashSet<>();
                brokenNicsToNetworks.put(baseNicName, networks);
            }
            networks.add(iface.getNetworkName());
        }
    }
    return brokenNicsToNetworks;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Network(org.ovirt.engine.core.common.businessentities.network.Network) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 2 with Network

use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.

the class ClusterListModel method onSaveInternalWithModel.

private void onSaveInternalWithModel(final ClusterModel model) {
    Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem()));
    model.startProgress();
    final Network managementNetwork = model.getManagementNetwork().getSelectedItem();
    final ManagementNetworkOnClusterOperationParameters clusterOperationParameters = new ManagementNetworkOnClusterOperationParameters(cluster, managementNetwork.getId());
    final ActionType actionType = model.getIsNew() ? ActionType.AddCluster : ActionType.UpdateCluster;
    Frontend.getInstance().runAction(actionType, clusterOperationParameters, result -> {
        ClusterListModel<Void> localModel = (ClusterListModel<Void>) result.getState();
        if (model.getIsImportGlusterConfiguration().getEntity()) {
            localModel.postOnSaveInternalWithImport(result.getReturnValue());
        } else {
            localModel.postOnSaveInternal(result.getReturnValue());
        }
    }, this);
}
Also used : ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) Network(org.ovirt.engine.core.common.businessentities.network.Network) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 3 with Network

use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.

the class ClusterNetworkListModel method setAsDisplay.

public void setAsDisplay() {
    final Network network = (Network) Cloner.clone(getSelectedItem());
    network.getCluster().setDisplay(true);
    final NetworkClusterParameters networkClusterParameters = new NetworkClusterParameters(network.getCluster());
    Frontend.getInstance().runAction(ActionType.UpdateNetworkOnCluster, networkClusterParameters);
}
Also used : NetworkClusterParameters(org.ovirt.engine.core.common.action.NetworkClusterParameters) Network(org.ovirt.engine.core.common.businessentities.network.Network)

Example 4 with Network

use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.

the class NetworkListModel method updateDetailsAvailability.

@Override
protected void updateDetailsAvailability() {
    super.updateDetailsAvailability();
    NetworkView network = getSelectedItem();
    if (network == null || !network.isExternal()) {
        externalSubnetListModel.setIsAvailable(false);
    } else {
        AsyncDataProvider.getInstance().getProviderById(new AsyncQuery<>(provider -> {
            boolean available = provider != null ? !provider.getIsUnmanaged() : false;
            externalSubnetListModel.setIsAvailable(available);
        }), network.getProvidedBy().getProviderId());
    }
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkModel) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) Inject(com.google.inject.Inject) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) EditNetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.EditNetworkModel) ArrayList(java.util.ArrayList) NewNetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkModel) RemoveNetworksModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.RemoveNetworksModel) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) Network(org.ovirt.engine.core.common.businessentities.network.Network) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) List(java.util.List) Provider(com.google.inject.Provider) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView) NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView)

Example 5 with Network

use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.

the class EditProviderModel method showConfirmation.

private void showConfirmation() {
    if (providedNetworks.isEmpty()) {
        actualSave();
        return;
    }
    // $NON-NLS-1$
    StringBuilder networkList = new StringBuilder("Networks:\n");
    for (Network network : providedNetworks) {
        // $NON-NLS-1$
        networkList.append("- ").append(network.getName()).append('\n');
    }
    ConfirmationModel confirmationModel = new ConfirmationModel();
    confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().providerUrlWarningTitle());
    confirmationModel.setMessage(ConstantsManager.getInstance().getMessages().providerUrlWarningText(networkList.toString()));
    UICommand cmdOk = UICommand.createDefaultOkUiCommand(CMD_APPROVE, this);
    confirmationModel.getCommands().add(cmdOk);
    // $NON-NLS-1$
    UICommand cmdCancel = UICommand.createCancelUiCommand(CMD_CANCEL, this);
    confirmationModel.getCommands().add(cmdCancel);
    sourceListModel.setConfirmWindow(confirmationModel);
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Aggregations

Network (org.ovirt.engine.core.common.businessentities.network.Network)292 Test (org.junit.Test)105 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)63 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)47 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)46 ArrayList (java.util.ArrayList)44 Guid (org.ovirt.engine.core.compat.Guid)44 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)39 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)23 List (java.util.List)21 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)21 HashMap (java.util.HashMap)19 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)19 Map (java.util.Map)13 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)13 VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)13 HashSet (java.util.HashSet)9 Set (java.util.Set)9 BusinessEntityMap (org.ovirt.engine.core.common.businessentities.BusinessEntityMap)9 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)9