Search in sources :

Example 71 with VmNetworkInterface

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

the class VfSchedulerImplTest method multipleVnicCommonTest.

private void multipleVnicCommonTest(boolean allNicsValid) {
    VmNetworkInterface vnic1 = mockVnic(true, "net1");
    VmNetworkInterface vnic2 = mockVnic(true, "net2");
    VmNetworkInterface vnic3 = mockVnic(false);
    VmNetworkInterface vnic4 = mockVnic(false);
    HostNicVfsConfig hostNicVfsConfig1 = new HostNicVfsConfig();
    updateVfsConfig(hostNicVfsConfig1, vnic1, true, false, true);
    HostNicVfsConfig hostNicVfsConfig2 = new HostNicVfsConfig();
    updateVfsConfig(hostNicVfsConfig2, vnic2, false, allNicsValid, allNicsValid);
    mockVfsConfigsOnHost(Arrays.asList(hostNicVfsConfig1, hostNicVfsConfig2));
    List<VmNetworkInterface> allVnics = Arrays.asList(vnic1, vnic2, vnic3, vnic4);
    if (allNicsValid) {
        assertHostValid(allVnics);
    } else {
        assertHostNotValid(allVnics, Collections.singletonList(vnic2.getName()));
    }
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 72 with VmNetworkInterface

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

the class VfSchedulerImplTest method findFreeVfForVnicCommon.

private void findFreeVfForVnicCommon(boolean existFreeVf) {
    VmNetworkInterface vnic = mockVnic(true, "net1");
    HostNicVfsConfig hostNicVfsConfig = new HostNicVfsConfig();
    updateVfsConfig(hostNicVfsConfig, vnic, true, false, existFreeVf);
    mockVfsConfigsOnHost(Collections.singletonList(hostNicVfsConfig));
    String freeVf = vfScheduler.findFreeVfForVnic(hostId, createNetwork(vnic.getNetworkName()), vmId);
    if (existFreeVf) {
        assertNotNull(freeVf);
    } else {
        assertNull(freeVf);
    }
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 73 with VmNetworkInterface

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

the class VfSchedulerImplTest method hostNicHaveOneFreeVfWhichShareIommuGroup.

@Test
public void hostNicHaveOneFreeVfWhichShareIommuGroup() {
    VmNetworkInterface vnic = mockVnic(true);
    initHostWithOneVfsConfig(Collections.singletonList(vnic), 1, true, false, false, true, true, false);
    assertHostNotValid(Collections.singletonList(vnic), Collections.singletonList(vnic.getName()));
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

Example 74 with VmNetworkInterface

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

the class VfSchedulerImplTest method validAllNetworksAllowed.

@Test
public void validAllNetworksAllowed() {
    VmNetworkInterface vnic = mockVnic(true);
    initHostWithOneVfsConfig(Collections.singletonList(vnic), 5, true, false, false, true);
    assertHostValid(Collections.singletonList(vnic));
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

Example 75 with VmNetworkInterface

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

the class VfSchedulerImplTest method validNetworkInSriovConfig.

@Test
public void validNetworkInSriovConfig() {
    VmNetworkInterface vnic = mockVnic(true);
    initHostWithOneVfsConfig(Collections.singletonList(vnic), 5, false, true, false, true);
    assertHostValid(Collections.singletonList(vnic));
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

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