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;
}
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());
}
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);
}
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;
}
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());
}
Aggregations