sriov-network-device-plugin icon indicating copy to clipboard operation
sriov-network-device-plugin copied to clipboard

Info providers and devices packages

Open DmytroLinkin opened this issue 2 years ago • 3 comments

With a growing codebase grows resource/ package, which mostly used for keeping the code which doesn't fit into other packages. To cope with that create infoprovider/ and devices/ packages to:

  • make plugin more structured;
  • allow re-usage of the code by multiple plugins;
  • cover code with a new unit-tests.

infoprovider/ package contains info providers, which are moved from resources/ and, to have consistency, extracted from netdevice/ package.

devices/ package contains rdma and vdpa devices moved from netdevice/ package. As an accompanying changes implemented RdmaProvider interface to allow mocking of rdmamap package for unit tests. pciDevice is also moved into devices/, but its responsibility is splitted into:

  • apiDevice - implements APIDevice interface to expose device specific information to Kubernetes API;
  • hostDevice - implements HostDevice interface to reflect common for all devices functionality; is a base class used across the plugin;
  • pciDevice - implements PciDevice interface to reflect common for all PCI devices functionality.

Common functionality extracted from PciDevice is a preparation for future non-PCI based devices, like Auxiliary devices.

DmytroLinkin avatar Jul 26 '22 11:07 DmytroLinkin

/CC @adrianchiris

DmytroLinkin avatar Jul 26 '22 11:07 DmytroLinkin

Pull Request Test Coverage Report for Build 3601818690

  • 315 of 354 (88.98%) changed or added relevant lines in 21 files are covered.
  • 5 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+3.6%) to 80.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/sriovdp/manager.go 4 5 80.0%
pkg/factory/factory.go 10 11 90.91%
pkg/resources/pool_stub.go 1 2 50.0%
pkg/netdevice/pciNetDevice.go 15 17 88.24%
pkg/devices/gen_net.go 51 57 89.47%
pkg/infoprovider/vhostNetInfoProvider.go 45 51 88.24%
pkg/devices/vdpa.go 16 26 61.54%
pkg/utils/rdma_provider.go 0 12 0.0%
<!-- Total: 315 354
Files with Coverage Reduction New Missed Lines %
pkg/accelerator/accelDevice.go 2 84.62%
pkg/netdevice/pciNetDevice.go 3 69.84%
<!-- Total: 5
Totals Coverage Status
Change from base Build 3559238490: 3.6%
Covered Lines: 1684
Relevant Lines: 2105

💛 - Coveralls

coveralls avatar Jul 26 '22 11:07 coveralls

/retest

DmytroLinkin avatar Aug 22 '22 12:08 DmytroLinkin

Accidentally closed PR

DmytroLinkin avatar Oct 23 '22 18:10 DmytroLinkin

@adrianchiris are we good to merge this PR?

DmytroLinkin avatar Oct 27 '22 09:10 DmytroLinkin

@DmytroLinkin could you rebase this PR.

planning to get to it this week (fingers crossed :) )

adrianchiris avatar Nov 21 '22 16:11 adrianchiris

@DmytroLinkin could you rebase this PR.

planning to get to it this week (fingers crossed :) )

Done

DmytroLinkin avatar Nov 22 '22 09:11 DmytroLinkin

Took a while to get to this one, appreciate the patience @DmytroLinkin ! added some comments. overall i think it looks good.

adrianchiris avatar Nov 24 '22 16:11 adrianchiris