Search in sources :

Example 1 with HostNicVirtualFunctionsConfiguration

use of org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration in project ovirt-engine by oVirt.

the class BackendHostNicsResource method doPopulate.

@Override
protected HostNic doPopulate(HostNic model, VdsNetworkInterface entity) {
    final HostNic hostNic = super.doPopulate(model, entity);
    final Guid nicId = entity.getId();
    final HostNicVfsConfig hostNicVfsConfig = findVfsConfig(nicId);
    if (hostNicVfsConfig == null) {
        final Map<Guid, Guid> vfMap = retriveVfMap();
        final Guid physicalFunctionNicId = vfMap.get(nicId);
        if (physicalFunctionNicId != null) {
            final HostNic physicalFunction = new HostNic();
            physicalFunction.setId(physicalFunctionNicId.toString());
            hostNic.setPhysicalFunction(physicalFunction);
        }
    } else {
        final Mapper<HostNicVfsConfig, HostNicVirtualFunctionsConfiguration> mapper = getMapper(HostNicVfsConfig.class, HostNicVirtualFunctionsConfiguration.class);
        final HostNicVirtualFunctionsConfiguration vfsConfigModel = mapper.map(hostNicVfsConfig, new HostNicVirtualFunctionsConfiguration());
        hostNic.setVirtualFunctionsConfiguration(vfsConfigModel);
    }
    return hostNic;
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) HostNicVirtualFunctionsConfiguration(org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration) HostNic(org.ovirt.engine.api.model.HostNic) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

HostNic (org.ovirt.engine.api.model.HostNic)1 HostNicVirtualFunctionsConfiguration (org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration)1 HostNicVfsConfig (org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)1 Guid (org.ovirt.engine.core.compat.Guid)1