Skip to content

Commit

Permalink
add virt-config to device controller
Browse files Browse the repository at this point in the history
Signed-off-by: Vladik Romanovsky <[email protected]>
  • Loading branch information
vladikr committed Nov 2, 2020
1 parent 7035943 commit fb25332
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/virt-handler/device-manager/device_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import (
"math"
"os"
"time"
"strings"

"kubevirt.io/client-go/log"
virtconfig "kubevirt.io/kubevirt/pkg/virt-config"
)

const (
Expand All @@ -41,10 +43,11 @@ type DeviceController struct {
host string
maxDevices int
backoff []time.Duration
virtConfig *virtconfig.ClusterConfig
}

func NewDeviceController(host string, maxDevices int) *DeviceController {
return &DeviceController{
func NewDeviceController(host string, maxDevices int, clusterConfig *virtconfig.ClusterConfig) *DeviceController {
controller := &DeviceController{
devicePlugins: []GenericDevice{
NewGenericDevicePlugin(KVMName, KVMPath, maxDevices, false),
NewGenericDevicePlugin(TunName, TunPath, maxDevices, true),
Expand All @@ -54,6 +57,9 @@ func NewDeviceController(host string, maxDevices int) *DeviceController {
maxDevices: maxDevices,
backoff: []time.Duration{1 * time.Second, 2 * time.Second, 5 * time.Second, 10 * time.Second},
}
controller.virtConfig = clusterConfig

return controller
}

func (c *DeviceController) nodeHasDevice(devicePath string) bool {
Expand Down

0 comments on commit fb25332

Please sign in to comment.