use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.
the class RefreshHostDevicesCommand method createHostNicVfsConfigToAddIfNotExist.
private HostNicVfsConfig createHostNicVfsConfigToAddIfNotExist(HostDevice device) {
VdsNetworkInterface nic = networkDeviceHelper.getNicByPciDevice(device, fetchedMap.values());
if (nic == null) {
return null;
}
HostNicVfsConfig existingHostNicVfsConfig = hostNicVfsConfigDao.getByNicId(nic.getId());
if (existingHostNicVfsConfig != null) {
return null;
}
return new HostNicVfsConfig(Guid.newGuid(), nic.getId(), true);
}
use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.
the class RefreshHostDevicesCommand method removeInvalidHostNicVfsConfigsFromDb.
private void removeInvalidHostNicVfsConfigsFromDb() {
final List<HostNicVfsConfig> hostNicVfsConfigsToRemove = new ArrayList<>();
List<HostNicVfsConfig> hostNicVfsConfigs = hostNicVfsConfigDao.getAllVfsConfigByHostId(getVdsId());
for (HostNicVfsConfig hostNicVfsConfig : hostNicVfsConfigs) {
VdsNetworkInterface nic = interfaceDao.get(hostNicVfsConfig.getNicId());
HostDevice pciDevice = null;
if (nic != null) {
String pciDeviceName = networkDeviceHelper.getPciDeviceNameByNic(nic);
pciDevice = fetchedMap.get(pciDeviceName);
}
if (nic == null || pciDevice == null || !networkDeviceHelper.isSriovDevice(pciDevice)) {
addToListIfNotNull(hostNicVfsConfig, hostNicVfsConfigsToRemove);
}
}
if (!hostNicVfsConfigsToRemove.isEmpty()) {
hostNicVfsConfigDao.removeAllInBatch(hostNicVfsConfigsToRemove);
}
}
use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.
the class BackendHostNicResource method updateVirtualFunctionsConfiguration.
@Override
public Response updateVirtualFunctionsConfiguration(Action action) {
validateParameters(action, "virtualFunctionsConfiguration.numberOfVirtualFunctions|allNetworksAllowed");
final HostNicVfsConfig vfsConfig = parent.findVfsConfig(guid);
if (vfsConfig == null) {
return notAllowed(localize(Messages.INVALID_OPERATION_ON_NON_SRIOV_NIC), guid.toString());
}
UpdateHostNicVfsConfigParameters params = prepareUpdateHostNicVfsConfigParameters(action, vfsConfig);
return doAction(ActionType.UpdateHostNicVfsConfig, params, action);
}
use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.
the class BackendHostNicResource method prepareUpdateHostNicVfsConfigParameters.
private UpdateHostNicVfsConfigParameters prepareUpdateHostNicVfsConfigParameters(Action action, HostNicVfsConfig vfsConfig) {
final Mapper<HostNicVfsConfig, UpdateHostNicVfsConfigParameters> entityMapper = getMapper(HostNicVfsConfig.class, UpdateHostNicVfsConfigParameters.class);
UpdateHostNicVfsConfigParameters params = entityMapper.map(vfsConfig, new UpdateHostNicVfsConfigParameters());
final Mapper<org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration, UpdateHostNicVfsConfigParameters> userInputMapper = getMapper(org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration.class, UpdateHostNicVfsConfigParameters.class);
userInputMapper.map(action.getVirtualFunctionsConfiguration(), params);
return params;
}
Aggregations