Merge pull request #715 from eguzman3/vfio-ids

devices: add per-device VFIO ids
This commit is contained in:
Sebastien Boeuf 2018-09-12 09:56:17 -07:00 committed by GitHub
commit a5f05bf3e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"strconv"
"strings"
"github.com/sirupsen/logrus"
@ -64,14 +65,14 @@ func (device *VFIODevice) Attach(devReceiver api.DeviceReceiver) error {
}
// Pass all devices in iommu group
for _, deviceFile := range deviceFiles {
for i, deviceFile := range deviceFiles {
//Get bdf of device eg 0000:00:1c.0
deviceBDF, err := getBDF(deviceFile.Name())
if err != nil {
return err
}
vfio := &config.VFIODev{
ID: utils.MakeNameID("vfio", device.DeviceInfo.ID, maxDevIDSize),
ID: utils.MakeNameID("vfio", device.DeviceInfo.ID+strconv.Itoa(i), maxDevIDSize),
BDF: deviceBDF,
}
device.vfioDevs = append(device.vfioDevs, vfio)