mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 23:04:20 +01:00
vhost-user-blk: Use PciPath type for vhost user devices
VhostUserDeviceAttrs::PCIAddr didn't actually store a PCI address
(DDDD:BB:DD.F), but rather a PCI path. Use the PciPath type and
rename things to make that clearer.
TestHandleBlockVolume previously used the bizarre value "0001:01"
which is neither a PCI address nor a PCI path for this value. Change
it to a valid PCI path - it appears the actual value didn't matter for
that test, as long as it was consistent.
Forward port of
3596058c67
fixes #1040
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
@@ -353,7 +353,8 @@ func TestHandleBlockVolume(t *testing.T) {
|
||||
vDestination := "/VhostUserBlk/destination"
|
||||
bDestination := "/DeviceBlock/destination"
|
||||
dDestination := "/DeviceDirectBlock/destination"
|
||||
vPCIAddr := "0001:01"
|
||||
vPCIPath, err := vcTypes.PciPathFromString("01/02")
|
||||
assert.NoError(t, err)
|
||||
bPCIPath, err := vcTypes.PciPathFromString("03/04")
|
||||
assert.NoError(t, err)
|
||||
dPCIPath, err := vcTypes.PciPathFromString("04/05")
|
||||
@@ -362,7 +363,7 @@ func TestHandleBlockVolume(t *testing.T) {
|
||||
bDev := drivers.NewBlockDevice(&config.DeviceInfo{ID: bDevID})
|
||||
dDev := drivers.NewBlockDevice(&config.DeviceInfo{ID: dDevID})
|
||||
|
||||
vDev.VhostUserDeviceAttrs = &config.VhostUserDeviceAttrs{PCIAddr: vPCIAddr}
|
||||
vDev.VhostUserDeviceAttrs = &config.VhostUserDeviceAttrs{PCIPath: vPCIPath}
|
||||
bDev.BlockDrive = &config.BlockDrive{PCIPath: bPCIPath}
|
||||
dDev.BlockDrive = &config.BlockDrive{PCIPath: dPCIPath}
|
||||
|
||||
@@ -413,7 +414,7 @@ func TestHandleBlockVolume(t *testing.T) {
|
||||
Fstype: "bind",
|
||||
Options: []string{"bind"},
|
||||
Driver: kataBlkDevType,
|
||||
Source: vPCIAddr,
|
||||
Source: vPCIPath.String(),
|
||||
}
|
||||
bStorage := &pb.Storage{
|
||||
MountPoint: bDestination,
|
||||
@@ -511,7 +512,7 @@ func TestAppendVhostUserBlkDevices(t *testing.T) {
|
||||
},
|
||||
VhostUserDeviceAttrs: &config.VhostUserDeviceAttrs{
|
||||
Type: config.VhostUserBlk,
|
||||
PCIAddr: testPCIPath.String(),
|
||||
PCIPath: testPCIPath,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user