Skip to content

Commit

Permalink
Merge pull request #3 from mcastelino/topic/virtio-mmio
Browse files Browse the repository at this point in the history
HACK: The VmPath is not getting properly populated
  • Loading branch information
Eric Ernst authored Dec 6, 2018
2 parents 8e12712 + ec07e0f commit 3e237af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions virtcontainers/device/drivers/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ func (device *BlockDevice) Attach(devReceiver api.DeviceReceiver) (err error) {
}

customOptions := device.DeviceInfo.DriverOptions
if customOptions != nil && customOptions["block-driver"] == "virtio-blk" {
drive.VirtPath = filepath.Join("/dev", driveName)
if customOptions != nil {
if customOptions["block-driver"] == "virtio-blk" {
drive.VirtPath = filepath.Join("/dev", driveName)
}
if customOptions["block-driver"] == "virtio-mmio" {
drive.VirtPath = filepath.Join("/dev", driveName)
}
} else {
scsiAddr, err := utils.GetSCSIAddress(index)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,10 @@ func (k *kataAgent) appendDevices(deviceList []*grpc.Device, c *Container) []*gr
ContainerPath: dev.ContainerPath,
}

if d.SCSIAddr == "" {
if d.VirtPath != "" {
kataDevice.Type = kataMmioBlkDevType
kataDevice.Id = d.VirtPath
} else if d.SCSIAddr == "" {
kataDevice.Type = kataBlkDevType
kataDevice.Id = d.PCIAddr
} else {
Expand Down Expand Up @@ -1283,6 +1286,9 @@ func (k *kataAgent) handleBlockVolumes(c *Container) []*grpc.Storage {
if c.sandbox.config.HypervisorConfig.BlockDeviceDriver == VirtioBlock {
vol.Driver = kataBlkDevType
vol.Source = blockDrive.PCIAddr
} else if c.sandbox.config.HypervisorConfig.BlockDeviceDriver == VirtioMmio {
vol.Driver = kataMmioBlkDevType
vol.Source = blockDrive.VirtPath
} else {
vol.Driver = kataSCSIDevType
vol.Source = blockDrive.SCSIAddr
Expand Down

0 comments on commit 3e237af

Please sign in to comment.