From ec07e0f5a7d658971f462111d62848f3e95a304f Mon Sep 17 00:00:00 2001 From: Manohar Castelino Date: Wed, 5 Dec 2018 20:37:41 -0800 Subject: [PATCH] HACK: The VmPath is not getting properly populated This does not fix it. But still does some things right Signed-off-by: Manohar Castelino --- virtcontainers/device/drivers/block.go | 9 +++++++-- virtcontainers/kata_agent.go | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/virtcontainers/device/drivers/block.go b/virtcontainers/device/drivers/block.go index cbbe7bb316..dd7d801148 100644 --- a/virtcontainers/device/drivers/block.go +++ b/virtcontainers/device/drivers/block.go @@ -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 { diff --git a/virtcontainers/kata_agent.go b/virtcontainers/kata_agent.go index eb8536ae60..b0467016d9 100644 --- a/virtcontainers/kata_agent.go +++ b/virtcontainers/kata_agent.go @@ -855,7 +855,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 { @@ -1277,6 +1280,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