sriov-network-device-plugin
sriov-network-device-plugin copied to clipboard
Info providers and devices packages
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
- implementsAPIDevice
interface to expose device specific information to Kubernetes API; -
hostDevice
- implementsHostDevice
interface to reflect common for all devices functionality; is a base class used across the plugin; -
pciDevice
- implementsPciDevice
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.
/CC @adrianchiris
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 | |
---|---|
Change from base Build 3559238490: | 3.6% |
Covered Lines: | 1684 |
Relevant Lines: | 2105 |
💛 - Coveralls
/retest
Accidentally closed PR
@adrianchiris are we good to merge this PR?
@DmytroLinkin could you rebase this PR.
planning to get to it this week (fingers crossed :) )
@DmytroLinkin could you rebase this PR.
planning to get to it this week (fingers crossed :) )
Done
Took a while to get to this one, appreciate the patience @DmytroLinkin ! added some comments. overall i think it looks good.