Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: fix sandbox store struct VFIODevice bug
Browse files Browse the repository at this point in the history
Since struct VFIODevice needed to be stored into disk by storeSandboxDevices() function,
however struct VFIODevice has a field named "vfioDevs", which is named begin with lower-case,
so it can't be written into file by json.Marshal.And this bug will will cause hotplug vfio
device can not been removed correctly while container exits.

Fixes: #924

Signed-off-by: flyflypeng <[email protected]>
  • Loading branch information
flyflypeng committed Nov 20, 2018
1 parent ccc41d7 commit cba7a88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions virtcontainers/device/drivers/vfio.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
// to be used by the Virtual Machine.
type VFIODevice struct {
*GenericDevice
vfioDevs []*config.VFIODev
VfioDevs []*config.VFIODev
}

// NewVFIODevice create a new VFIO device
Expand Down Expand Up @@ -77,7 +77,7 @@ func (device *VFIODevice) Attach(devReceiver api.DeviceReceiver) error {
BDF: deviceBDF,
SysfsDev: deviceSysfsDev,
}
device.vfioDevs = append(device.vfioDevs, vfio)
device.VfioDevs = append(device.VfioDevs, vfio)
}

// hotplug a VFIO device is actually hotplugging a group of iommu devices
Expand Down Expand Up @@ -126,7 +126,7 @@ func (device *VFIODevice) DeviceType() config.DeviceType {

// GetDeviceInfo returns device information used for creating
func (device *VFIODevice) GetDeviceInfo() interface{} {
return device.vfioDevs
return device.VfioDevs
}

// It should implement GetAttachCount() and DeviceID() as api.Device implementation
Expand Down

0 comments on commit cba7a88

Please sign in to comment.