use of org.ovirt.engine.core.common.businessentities.HostDevice in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method createFreeVf.
private HostDevice createFreeVf(HostNicVfsConfig hostNicVfsConfig) {
HostDevice vf = createVf();
ArgumentMatcher<List<String>> matchNotContainVf = argVf -> argVf == null || !argVf.contains(vf.getName());
when(networkDeviceHelper.getFreeVf(eq(getNic(hostNicVfsConfig)), argThat(matchNotContainVf))).thenReturn(vf);
return vf;
}
use of org.ovirt.engine.core.common.businessentities.HostDevice in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method hostNicHaveTwoFreeVfOneShouldBeDirectlyPassthrough.
@Test
public void hostNicHaveTwoFreeVfOneShouldBeDirectlyPassthrough() {
VmNetworkInterface vnic = mockVnic(true);
List<HostDevice> vfs = initHostWithOneVfsConfig(Collections.singletonList(vnic), 2, true, false, false, true, false, true);
HostDevice freeVf = vfs.get(0);
mockVfDirectlyAttached(false, freeVf);
expectedVnicToVfMap.put(vnic.getId(), freeVf.getDeviceName());
assertHostValid(Collections.singletonList(vnic));
}
use of org.ovirt.engine.core.common.businessentities.HostDevice in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method updateVfsConfig.
private HostDevice updateVfsConfig(HostNicVfsConfig hostNicVfsConfig, VmNetworkInterface vnic, int numOfVfs, boolean allNetworksAllowed, boolean vnicNetworkInSriovConfig, boolean vnicLabelInSriovConfig, boolean hasFreeVf, boolean freeVfShareIommuGroup, boolean vfDirectlyAttached) {
hostNicVfsConfig.setNicId(Guid.newGuid());
hostNicVfsConfig.setNumOfVfs(numOfVfs);
hostNicVfsConfig.setAllNetworksAllowed(allNetworksAllowed);
updateVfsConfigNetworks(hostNicVfsConfig, vnic, vnicNetworkInSriovConfig);
updateVfsConfigLabels(hostNicVfsConfig, vnic, vnicLabelInSriovConfig);
VdsNetworkInterface nic = new VdsNetworkInterface();
nic.setId(hostNicVfsConfig.getNicId());
when(getNic(hostNicVfsConfig)).thenReturn(nic);
HostDevice vf = null;
if (hasFreeVf) {
vf = createFreeVf(hostNicVfsConfig);
mockVfShareIommuGroup(vf, freeVfShareIommuGroup);
if (!freeVfShareIommuGroup && (allNetworksAllowed || vnicNetworkInSriovConfig || vnicLabelInSriovConfig)) {
if (!vfDirectlyAttached) {
expectedVnicToVfMap.put(vnic.getId(), vf.getDeviceName());
}
mockVfDirectlyAttached(vfDirectlyAttached, vf);
}
}
return vf;
}
use of org.ovirt.engine.core.common.businessentities.HostDevice in project ovirt-engine by oVirt.
the class NetworkDeviceHelperImplTest method mockNetworkDeviceForPciDevice.
private HostDevice mockNetworkDeviceForPciDevice(HostDevice pciDeviceParam) {
HostDevice mockedNetDevice = new HostDevice();
mockedNetDevice.setParentDeviceName(pciDeviceParam.getDeviceName());
mockedNetDevice.setHostId(pciDeviceParam.getHostId());
mockedNetDevice.setDeviceName(pciDeviceParam.getDeviceName() + "netDevice");
mockedNetDevice.setNetworkInterfaceName(mockedNetDevice.getDeviceName() + "iface");
return mockedNetDevice;
}
use of org.ovirt.engine.core.common.businessentities.HostDevice in project ovirt-engine by oVirt.
the class NetworkDeviceHelperImplTest method isNetworkDeviceNonNetworkFree.
@Test
public void isNetworkDeviceNonNetworkFree() {
freeVfCommon(0, 0, 0, 1, 0, 0);
HostDevice hostDevice = getSingleMockedNonFreeDevice();
assertFalse(networkDeviceHelper.isDeviceNetworkFree(hostDevice));
}
Aggregations