Search in sources :

Example 81 with VmNetworkInterface

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

the class VnicProfileHelperTest method createVnic.

private VmNetworkInterface createVnic(String vnicName, String networkName) {
    final VmNetworkInterface vmInterface = new VmNetworkInterface();
    vmInterface.setName(vnicName);
    vmInterface.setNetworkName(networkName);
    return vmInterface;
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 82 with VmNetworkInterface

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

the class OvfReader method readNetworkItem.

private void readNetworkItem(XmlNode node, int nicIdx) {
    VmNetworkInterface iface = getNetworkInterface(node);
    updateSingleNic(node, iface, nicIdx);
    readManagedVmDevice(node, iface.getId());
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 83 with VmNetworkInterface

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

the class VmInstanceTypeManager method updateNetworkInterfaces.

private void updateNetworkInterfaces(final ProfileBehavior behavior, final List<VmNetworkInterface> argNics) {
    AsyncQuery<List<VnicProfileView>> query = new AsyncQuery<>(profiles -> {
        List<VnicInstanceType> vnicInstanceTypes = new ArrayList<>();
        List<VmNetworkInterface> nics = (argNics == null) ? new ArrayList<VmNetworkInterface>() : argNics;
        for (VmNetworkInterface nic : nics) {
            final VnicInstanceType vnicInstanceType = new VnicInstanceType(nic);
            vnicInstanceType.setItems(profiles);
            behavior.initSelectedProfile(vnicInstanceType, vnicInstanceType.getNetworkInterface());
            vnicInstanceTypes.add(vnicInstanceType);
        }
        getModel().getNicsWithLogicalNetworks().getVnicProfiles().setItems(profiles);
        getModel().getNicsWithLogicalNetworks().setItems(vnicInstanceTypes);
        getModel().getNicsWithLogicalNetworks().setSelectedItem(Linq.firstOrNull(vnicInstanceTypes));
    });
    behavior.initProfiles(getModel().getSelectedCluster().getId(), getModel().getSelectedDataCenter().getId(), query);
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) VnicInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType)

Example 84 with VmNetworkInterface

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

the class VfSchedulerImpl method validatePassthroughVnics.

@Override
public List<String> validatePassthroughVnics(Guid vmId, Guid hostId, List<VmNetworkInterface> allVmNics) {
    List<VmNetworkInterface> pluggedPassthroughVnics = getPluggedPassthroughVnics(allVmNics);
    if (pluggedPassthroughVnics.isEmpty()) {
        return Collections.emptyList();
    }
    Map<Guid, Map<Guid, String>> hostToVnicToVfMap = vmToHostToVnicToVfMap.get(vmId);
    if (hostToVnicToVfMap == null) {
        hostToVnicToVfMap = new HashMap<>();
        vmToHostToVnicToVfMap.put(vmId, hostToVnicToVfMap);
    }
    Map<Guid, List<String>> nicToUsedVfs = new HashMap<>();
    Map<Guid, VdsNetworkInterface> fetchedNics = new HashMap<>();
    List<String> problematicVnics = new ArrayList<>();
    List<HostNicVfsConfig> vfsConfigs = networkDeviceHelper.getHostNicVfsConfigsWithNumVfsDataByHostId(hostId);
    Map<Guid, String> vnicToVfMap = new HashMap<>();
    hostToVnicToVfMap.put(hostId, vnicToVfMap);
    for (final VmNetworkInterface vnic : pluggedPassthroughVnics) {
        String freeVf = findFreeVfForVnic(vfsConfigs, nicToUsedVfs, fetchedNics, vnic.getNetworkName() == null ? null : networkDao.getByNameAndDataCenter(vnic.getNetworkName(), hostDao.get(hostId).getStoragePoolId()), vnic.getVmId(), true);
        if (freeVf == null) {
            problematicVnics.add(vnic.getName());
        } else {
            vnicToVfMap.put(vnic.getId(), freeVf);
        }
    }
    return problematicVnics;
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) ArrayList(java.util.ArrayList) List(java.util.List) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 85 with VmNetworkInterface

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

the class VmNicFilterParameterValidatorTest method setUp.

@Before
public void setUp() {
    validator = new VmNicFilterParameterValidator(vmNicFilterParameterDao, vmNicDao);
    VmNetworkInterface vmNetworkInterface = new VmNetworkInterface();
    vmNetworkInterface.setVmId(usedId);
    when(vmNicDao.get(usedId)).thenReturn(vmNetworkInterface);
    when(vmNicFilterParameterDao.get(usedId)).thenReturn(new VmNicFilterParameter());
    when(vmDao.get(usedId)).thenReturn(new VM());
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VM(org.ovirt.engine.core.common.businessentities.VM) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter) Before(org.junit.Before)

Aggregations

VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)115 Test (org.junit.Test)27 ArrayList (java.util.ArrayList)25 Guid (org.ovirt.engine.core.compat.Guid)19 VM (org.ovirt.engine.core.common.businessentities.VM)16 HashMap (java.util.HashMap)11 List (java.util.List)9 Map (java.util.Map)9 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)6 MapVnicsContext (org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext)5 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)5 HostNicVfsConfig (org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)5 VmNetworkStatistics (org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics)5 Nic (org.ovirt.engine.api.model.Nic)4 VnicProfileHelper (org.ovirt.engine.core.bll.network.vm.VnicProfileHelper)4 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)4 Collection (java.util.Collection)3