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

Commit

Permalink
Merge pull request #790 from likebreath/fix_789
Browse files Browse the repository at this point in the history
device: Allow to use the "VmPath" field when adding block devices
  • Loading branch information
amshinde authored Jun 10, 2020
2 parents 33fa379 + c01192e commit 0e22a91
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,15 @@ func virtioBlkCCWDeviceHandler(ctx context.Context, device pb.Device, spec *pb.S
// Here, bridgeAddr is the address at which the brige is attached on the root bus,
// while deviceAddr is the address at which the device is attached on the bridge.
func virtioBlkDeviceHandler(_ context.Context, device pb.Device, spec *pb.Spec, s *sandbox) error {
// Get the device node path based on the PCI device address
devPath, err := getPCIDeviceName(s, device.Id)
if err != nil {
return err
// When "Id (PCIAddr)" is not set, we allow to use the predicted "VmPath" passed from kata-runtime
if device.Id != "" {
// Get the device node path based on the PCI device address
devPath, err := getPCIDeviceName(s, device.Id)
if err != nil {
return err
}
device.VmPath = devPath
}
device.VmPath = devPath

return updateSpecDeviceList(device, spec)
}
Expand Down

0 comments on commit 0e22a91

Please sign in to comment.